tags:

views:

110

answers:

2

I read cheyenne server is going to implement it ( http://web.syllable.org/news/2010-01-02-22-16-WebSockets-for-Cheyenne-web-server.html ) , but for learning purpose I'd like more to see the shortest sample code of a websocket server and a websocket client in rebol / rebol or rebol / rebol view or rebol / javascript.

like this example in java http://blog.jwebsocket.org/2010/06/17/jwebsocket-instead-of-xhr-and-comet/

or this example in php http://blog.digitalbackcountry.com/2010/07/websocket-charting-demo-with-html5-and-javascript/

Could also Rebol include such protocol natively in some future like for the rest (http, ftp,...) ?

A: 

I looked at this recently and writing a ws:// protocol does not look like it will take long, and looks to be quite straight forward. Perhaps you could try writing it yourself.

Well, since I wrote this, Endo has released his ws:// protocol

http://www.moldibi.com/rebol/ws.html

Graham Chiu
Well no I'm not capable of writing a protocol in rebol at least not yet so thanks Endo :)
Rebol Tutorial
I was also thinking like that, but it wasn't hard :) See this document for details http://www.rebolforces.com/articles/protocols/
endo64
+1  A: 

I write this by looking at this java example: http://github.com/adamac/Java-WebSocket-client/blob/master/src/com/sixfire/websocket/WebSocket.java

and tested only with this ws chat server http://www.codeproject.com/KB/webservices/c_sharp_web_socket_server.aspx

it supports framing (0x00 - - 0xFF), when you pick the port it returns the last , if no msg then returns none. currently it does not support data frames (0x80 - 0xFE) and no support for utf8.

Take it as an example.

endo64
Great thanks that's amazing !
Rebol Tutorial
I've updated the script on http://www.moldibi.com/rebol/ws.html"pick p 1" returns empty string instead of none.
endo64