Skip to content

Commit

Permalink
ws connect now also has Query
Browse files Browse the repository at this point in the history
  • Loading branch information
vans163 committed Feb 6, 2017
1 parent e9fc8a4 commit aecea24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ http('GET', Path, Query, Headers, Body, S) ->
-module(ws_emitter).
-compile(export_all).

connect(_Headers, S) -> S.
connect(_Query, _Headers, S) -> S.
disconnect(S) -> ok.


Expand Down Expand Up @@ -230,10 +230,10 @@ Using max_heap_size erl vm arg can somewhat remedy this problem.
```erlang
-module(ws_transmission).

-export([connect/2, disconnect/1]).
-export([connect/3, disconnect/1]).
-export([msg/2, handle_info/2]).

connect(Headers, S) ->
connect(_Query, Headers, S) ->
Socket = maps:get(socket, S),
Pid = self(),

Expand Down
4 changes: 2 additions & 2 deletions src/handler/handler_wildcard_ws.erl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-module(handler_wildcard_ws).

-export([connect/1, disconnect/1]).
-export([connect/3, disconnect/1]).
-export([msg/2]).
-export([handle_info/2]).

-include("../global.hrl").

connect(_Headers, S) ->
connect(_Query, _Headers, S) ->
Socket = maps:get(socket, S),
{ok, {SourceAddr, _}} = ?TRANSPORT_PEERNAME(Socket),
?PRINT({"WS_Unhandled: Connect", SourceAddr, self()}),
Expand Down
2 changes: 1 addition & 1 deletion src/logic_chain/ws_chain.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ proc(Type, Path, Query, Headers, Body, Data) ->

TempState = maps:get(temp_state, Data2),
TempState2 = TempState#{socket=> Socket},
case apply(WSHandlerAtom, connect, [Headers, TempState2]) of
case apply(WSHandlerAtom, connect, [Query, Headers, TempState2]) of
reject -> {websocket_reject, proto_http:response(<<"404">>, #{}, <<>>), Data2};

TempState3 ->
Expand Down

0 comments on commit aecea24

Please sign in to comment.