Tutorial :Any simple standalone code sample for a websocket protocol (ws) implementation in rebol?



Question:

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,...) ?


Solution:1

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.


Solution:2

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »