Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Explictly enable use of comet requests in misultin (pre-0.7 change)

  • Loading branch information...
commit 3c25e915b256f650d30caeb5bc0e2e459580cded 1 parent 37d4f24
@yrashk authored
View
5 src/socketio_http_misultin.erl
@@ -1,7 +1,7 @@
-module(socketio_http_misultin).
-behaviour(socketio_http_server).
-export([start_link/1, file/2, respond/2, respond/3, respond/4, parse_post/1, headers/2, chunk/2, stream/2,
- socket/1, get_headers/1, websocket_send/2]).
+ socket/1, get_headers/1, websocket_send/2, ensure_longpolling_request/1]).
start_link(Opts) ->
Port = proplists:get_value(port, Opts),
@@ -47,6 +47,9 @@ get_headers(Request) ->
websocket_send(Ws, Data) ->
Ws:send(Data).
+ensure_longpolling_request(Request) ->
+ Request:options([{comet, true}]).
+
%% Internal functions
handle_http(Server, Req) ->
View
2  src/socketio_http_server.erl
@@ -4,6 +4,6 @@
behaviour_info(callbacks) ->
[{start_link,1}, {file,2}, {respond,2}, {respond,3}, {respond,4},
{parse_post,1}, {headers,2}, {chunk,2}, {stream,2},
- {socket,1},{get_headers,1},{websocket_send,2}];
+ {socket,1},{get_headers,1},{websocket_send,2},{ensure_longpolling_request,1}];
behaviour_info(_Other) ->
undefined.
View
1  src/socketio_transport_htmlfile.erl
@@ -54,6 +54,7 @@ start_link(Sup, SessionId, ServerModule, ConnectionReference) ->
%% @end
%%--------------------------------------------------------------------
init([Sup, SessionId, ServerModule, {'htmlfile', {Req, Caller}}]) ->
+ apply(ServerModule, ensure_longpolling_request, [Req]),
process_flag(trap_exit, true),
HeartbeatInterval =
case application:get_env(heartbeat_interval) of
View
1  src/socketio_transport_polling.erl
@@ -153,6 +153,7 @@ handle_cast({TransportType, polling_request, {Req, Index}, Server}, State) ->
handle_cast({TransportType, polling_request, Req, Server}, State#state{ index = Index});
handle_cast({TransportType, polling_request, Req, Server}, #state { server_module = ServerModule,
polling_duration = Interval, message_buffer = [] } = State) ->
+ apply(ServerModule, ensure_longpolling_request, [Req]),
link(apply(ServerModule, socket, [Req])),
{noreply, State#state{ connection_reference = {TransportType, connected}, req = Req, caller = Server }, Interval};
View
1  src/socketio_transport_xhr_multipart.erl
@@ -54,6 +54,7 @@ start_link(Sup, SessionId, ServerModule, ConnectionReference) ->
%% @end
%%--------------------------------------------------------------------
init([Sup, SessionId, ServerModule, {'xhr-multipart', {Req, Caller}}]) ->
+ apply(ServerModule, ensure_longpolling_request, [Req]),
process_flag(trap_exit, true),
HeartbeatInterval =
case application:get_env(heartbeat_interval) of
Please sign in to comment.
Something went wrong with that request. Please try again.