From a738db07c2040461f0fd431f04ecf90b157ead5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 9 Apr 2015 23:13:57 +0300 Subject: Add gun_up and gun_down messages The flush(Pid) function was enhanced to also discard Websocket messages and the new up/down messages. --- src/gun_ws.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gun_ws.erl') 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(_) -> + {[], []}. -- cgit v1.2.3