aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_ws.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-04-09 23:13:57 +0300
committerLoïc Hoguin <[email protected]>2015-04-09 23:13:57 +0300
commita738db07c2040461f0fd431f04ecf90b157ead5b (patch)
tree3435489b45067c80fc7b7620cf02622676811c24 /src/gun_ws.erl
parent2badb594bdedfd1283306fe2075c2c51abdd600d (diff)
downloadgun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.gz
gun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.bz2
gun-a738db07c2040461f0fd431f04ecf90b157ead5b.zip
Add gun_up and gun_down messages
The flush(Pid) function was enhanced to also discard Websocket messages and the new up/down messages.
Diffstat (limited to 'src/gun_ws.erl')
-rw-r--r--src/gun_ws.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gun_ws.erl b/src/gun_ws.erl
index 5379362..246cc57 100644
--- a/src/gun_ws.erl
+++ b/src/gun_ws.erl
@@ -14,9 +14,11 @@
-module(gun_ws).
+-export([name/0]).
-export([init/5]).
-export([handle/2]).
-export([send/2]).
+-export([down/1]).
-record(payload, {
type = undefined :: cow_ws:frame_type(),
@@ -40,6 +42,8 @@
extensions = #{} :: cow_ws:extensions()
}).
+name() -> ws.
+
%% @todo Protocols
init(Owner, Socket, Transport, Extensions, _Protocols) ->
Owner ! {gun_ws_upgrade, self(), ok},
@@ -123,3 +127,7 @@ send(Frame, State=#ws_state{socket=Socket, transport=Transport, extensions=Exten
{close, _, _} -> close;
_ -> State
end.
+
+%% Websocket has no concept of streams.
+down(_) ->
+ {[], []}.