This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#51 2012-09-03 13:18:05

LiFaytheGoblin
Scratcher
Registered: 2011-11-14
Posts: 1000+

Re: Chat.js - A Node.js Chat

It always disconnects. And when I try to re-loggin, it says "this user is already online"
I resarted firefox, I deleted cookies and the cache and nothing helps  sad

Last edited by LiFaytheGoblin (2012-09-03 13:30:29)

Offline

 

#52 2012-09-04 09:47:18

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Chat.js - A Node.js Chat

Banning is implemented. >:)


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#53 2012-09-04 09:52:02

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

big_smile

Last edited by Hardmath123 (2012-09-04 09:52:10)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#54 2012-09-05 15:25:25

luiysia
Scratcher
Registered: 2011-07-05
Posts: 1000+

Re: Chat.js - A Node.js Chat

Bump  smile

I kind of think this was better off in M&C because more people saw it :\


http://i50.tinypic.com/dx00pd.gif

Offline

 

#55 2012-09-05 15:44:04

puppetadventurer
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Chat.js - A Node.js Chat

MathWizz wrote:

Banning is implemented. >:)

D:


3

Offline

 

#56 2012-09-05 23:11:11

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Chat.js - A Node.js Chat

Is there any way this could work on iOS?  tongue


........................................................................................................................................................................................................................................

Offline

 

#57 2012-09-06 08:19:56

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hey, I'm trying to connect to testchat.cloudno.de, port 9153 via Python sockets. It isn't working:

Code:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("testchat.cloudno.de", 9153))

It just goes into an infinite loop... help?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#58 2012-09-06 09:26:48

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hardmath123 wrote:

Hey, I'm trying to connect to testchat.cloudno.de, port 9153 via Python sockets. It isn't working:

Code:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("testchat.cloudno.de", 9153))

It just goes into an infinite loop... help?

try this?

Code:

s = socket.create_connection(("testchat.cloudno.de", 9153))

anyway, what do you mean by inifinite loop? you lose respond or it raises RecursionError?

Offline

 

#59 2012-09-06 09:45:07

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Chat.js - A Node.js Chat

roijac wrote:

Hardmath123 wrote:

Hey, I'm trying to connect to testchat.cloudno.de, port 9153 via Python sockets. It isn't working:

Code:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("testchat.cloudno.de", 9153))

It just goes into an infinite loop... help?

try this?

Code:

s = socket.create_connection(("testchat.cloudno.de", 9153))

anyway, what do you mean by inifinite loop? you lose respond or it raises RecursionError?

WebSockets have a different protocol. -.-


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#60 2012-09-06 09:55:08

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

So... how do I access it? I wanted to write my own client for iOS.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#61 2012-09-06 10:59:01

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hardmath123 wrote:

So... how do I access it? I wanted to write my own client for iOS.

I was playing with a Python websocket library — I think it was ws4py. I'd send you what I have so far, but I appear to have misplaced the code...

Presumably, though, you'll want to use Objective-C; so I'd have a look for something similar for C/Obj-C.  smile

[You could always implement the websockets protocol yourself, if you really wanted to; but it looks reasonably complicated.

Last edited by blob8108 (2012-09-06 11:00:44)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#62 2012-09-06 11:06:04

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

I didn't grok a word of that. I assumed websockets were just an interface for accessing normal sockets via JS...


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#63 2012-09-06 11:12:10

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Chat.js - A Node.js Chat

You'll probably have to wait for MathWizz to release an API of sorts so you can connect, because I'm pretty sure right now, it's ultra secure so no one can just randomly connect to the web server.


Hai.

Offline

 

#64 2012-09-06 11:12:24

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hardmath123 wrote:

I didn't grok a word of that. I assumed websockets were just an interface for accessing normal sockets via JS...

I thought that too, for a long time  tongue

Have a look at that Wikipedia article...


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#65 2012-09-06 11:14:00

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Chat.js - A Node.js Chat

fg123 wrote:

You'll probably have to wait for MathWizz to release an API of sorts so you can connect, because I'm pretty sure right now, it's ultra secure so no one can just randomly connect to the web server.

I managed to connect to it from my own Python code very happily  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#66 2012-09-07 13:41:43

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

Code:

/for i 0 10000000 1 {say $i}

Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#67 2012-09-08 01:08:17

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Chat.js - A Node.js Chat

^^ What does the $ operator do in Python (if that is Python -- I don't think it's JS)?

Offline

 

#68 2012-09-08 01:21:56

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Chat.js - A Node.js Chat

Nope, the $ is actually PHP. It's used to reference variables.
Like a variable named foo would be referenced and created in php as $foo.

Hardmath was posting an example of the code you can use in Chat.js, which nXIII Implemented. He decided to set variables like the way php did them, so that's why Hardmath's code has that $ in it.  tongue

tl;dr: It's not python.


Hai.

Offline

 

#69 2012-09-08 03:15:51

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

Actually this code simply posts the first 10000000 whole numbers. Replace "1" with "-1" for an infinite loop.  tongue

Last edited by Hardmath123 (2012-09-08 03:16:02)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#70 2012-09-08 11:17:43

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Chat.js - A Node.js Chat

Yep.  Because the value of the variable i will never reach the condition set by the for loop.  Although, I'm fairly certain that it could overflow if it went low enough...  1 is the value you change i by every iteration, right?
[C code]

Code:

for (int i = 0; i < 100000000000; i++)
{ 
    printf("%d", i);
}

Last edited by amcerbu (2012-09-08 11:24:02)

Offline

 

#71 2012-09-09 00:02:01

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hardmath123 wrote:

Actually this code simply posts the first 10000000 whole numbers. Replace "1" with "-1" for an infinite loop.  tongue

/for will throw an error for infinite loops.

EDIT:
The variables are not really like PHP. $<word> is a shortcut for an invocation of (var <word>) to make commands more readable. There's no shortcut for (set <word> <value>) (e.g., $<word> = <value>) because there are no infix operators.

Last edited by nXIII (2012-09-09 00:19:12)


nXIII

Offline

 

#72 2012-09-09 04:01:24

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Chat.js - A Node.js Chat

nXIII wrote:

Hardmath123 wrote:

Actually this code simply posts the first 10000000 whole numbers. Replace "1" with "-1" for an infinite loop.  tongue

/for will throw an error for infinite loops.

Yeah, I noticed a DOM_ERROR_11 or something. What's up with that? Did you code that in, or does HTML5 somehow catch it?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#73 2012-09-09 14:26:31

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Chat.js - A Node.js Chat

Hardmath123 wrote:

nXIII wrote:

Hardmath123 wrote:

Actually this code simply posts the first 10000000 whole numbers. Replace "1" with "-1" for an infinite loop.  tongue

/for will throw an error for infinite loops.

Yeah, I noticed a DOM_ERROR_11 or something. What's up with that? Did you code that in, or does HTML5 somehow catch it?

It should log "infinite /for loop" to the console:

> /for i 0 100 -1 { log $i }
< Error: infinite /for loop

The DOM_ERROR_11 was probably something else.

EDIT: here

Last edited by nXIII (2012-09-09 15:48:44)


nXIII

Offline

 

#74 2012-09-09 22:33:49

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: Chat.js - A Node.js Chat

I'm forever alone here  tongue


........................................................................................................................................................................................................................................

Offline

 

#75 2012-09-22 19:49:07

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: Chat.js - A Node.js Chat

Alone.  sad


http://i.imgur.com/0x8ia.jpg
gone

Offline

 

Board footer