[squeak-dev] SqueakJS WebSocket test passes; Flow, Lightning, Naiad to follow

Craig Latta craig at netjam.org
Sun Jan 18 03:50:57 UTC 2015


Hoi--

     http://tinyurl.com/mbhry6z (thiscontext.com blog post)

     Well, this is perverse fun. :)  The JavaScript WebSocket API works
from SqueakJS[1], so I guess I'll write a WebSocket server to proxy
peer-to-peer traffic between SqueakJS clients. This will let me
implement the Flow external streaming "primitive" interface, using only
the JavaScript bridge and no actual primitives. That will enable the
Lightning remote messaging protocol, and then Naiad. I'll run the server
on try.squeak.org and any other site that wants to be a Lightning node.


-C

***

"Test the WebSocket API with an echo server."

| report websocket |

Transcript clear.

report := [:label :data |
	Transcript
		cr;
		nextPutAll: label;
		print: data;
		endEntry].

websocket := (
	(JS Object new)
		at: #newWebSocket
		put: (JS Function new: 'return new
WebSocket("ws://echo.websocket.org");');
		newWebSocket).

websocket
	at: #onopen
	put: [:event |
		report value: 'opened: ' value: event.
		websocket send: 'hey there'];
	at: #onclose
	put: [:event | report value: 'closed: ' value: event];
	at: #onmessage
	put: [:event |
		report value: 'data: ' value: event data.
		websocket close];
	at: #onerror
	put: [:event | report value: 'error: ' value: event data]

***

[1] http://try.squeak.org

--
Craig Latta
netjam.org
+31   6 2757 7177 (SMS ok)
+ 1 415  287 3547 (no SMS)



More information about the Squeak-dev mailing list