path: root/README.md
diff options
authorLoïc Hoguin <[email protected]>2011-08-23 16:24:02 +0200
committerLoïc Hoguin <[email protected]>2011-08-23 23:49:58 +0200
commit2374aa7e07327acf8737823a75c1bf9bdfeafca4 (patch)
tree3f91b3bec61da780a87439434c05267a53c48d06 /README.md
parent24bf2c54d0f8e5a9edfa6f0fe8dfd01e2a57e1b0 (diff)
Add WebSocket drafts 7, 8, 9 and 10 implementation
The implementation is only partial for now but should work for all browsers implementing it.
Diffstat (limited to 'README.md')
1 files changed, 11 insertions, 3 deletions
diff --git a/README.md b/README.md
index 5a4315f..04a927c 100644
--- a/README.md
+++ b/README.md
@@ -195,12 +195,14 @@ websocket_init(TransportName, Req, _Opts) ->
erlang:start_timer(1000, self(), <<"Hello!">>),
{ok, Req, undefined_state}.
-websocket_handle(Msg, Req, State) ->
- {reply, << "That's what she said! ", Msg/binary >>, Req, State}.
+websocket_handle({text, Msg}, Req, State) ->
+ {reply, {text, << "That's what she said! ", Msg/binary >>}, Req, State};
+websocket_handle(_Data, Req, State) ->
+ {ok, Req, State}.
websocket_info({timeout, _Ref, Msg}, Req, State) ->
erlang:start_timer(1000, self(), <<"How' you doin'?">>),
- {reply, Msg, Req, State};
+ {reply, {text, Msg}, Req, State};
websocket_info(_Info, Req, State) ->
{ok, Req, State}.
@@ -212,6 +214,12 @@ Of course you can have an HTTP handler doing both HTTP and Websocket
handling, but for the sake of this example we're ignoring the HTTP
part entirely.
+As the Websocket protocol is still a draft the API is subject to change
+regularly when support to the most recent drafts gets added. Features may
+be added, changed or removed before the protocol gets finalized. Cowboy
+tries to implement all drafts transparently and give a single interface to
+handle them all, however.
Using Cowboy with other protocols