mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Add WebSocket drafts 7, 8, 9 and 10 implementation
The implementation is only partial for now but should work for all browsers implementing it.
This commit is contained in:
parent
24bf2c54d0
commit
2374aa7e07
4 changed files with 324 additions and 86 deletions
|
@ -20,12 +20,14 @@ websocket_init(_TransportName, Req, _Opts) ->
|
|||
erlang:start_timer(1000, self(), <<"websocket_init">>),
|
||||
{ok, Req, undefined}.
|
||||
|
||||
websocket_handle(Data, Req, State) ->
|
||||
{reply, Data, Req, State}.
|
||||
websocket_handle({text, Data}, Req, State) ->
|
||||
{reply, {text, Data}, Req, State};
|
||||
websocket_handle(_Frame, Req, State) ->
|
||||
{ok, Req, State}.
|
||||
|
||||
websocket_info({timeout, _Ref, Msg}, Req, State) ->
|
||||
erlang:start_timer(1000, self(), <<"websocket_handle">>),
|
||||
{reply, Msg, Req, State};
|
||||
{reply, {text, Msg}, Req, State};
|
||||
websocket_info(_Info, Req, State) ->
|
||||
{ok, Req, State}.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue