Hi Gregor, I had a similar problem once before. It seemed to happen when
the JS which started a WS connection was only in a static HTML file. It
seemed that the session wasn't started, and the session cookie consequently
wasn't sent, until the browser had actually accessed a CB controller URL.
So I made an empty controller that was served from / and included the HTML
for the page in its template rather than in a static HTML file, and from
then on the websocket handler received a SessionID. Maybe that'll work for
you too.
Cheers,
Igor
On Tuesday, June 10, 2014 1:42:51 PM UTC-4, Gregor Féng wrote:
>
> Hello,
>
> nobody else with this problem or know the solution?
>
> On Sat, May 31, 2014 at 03:18:06AM +0200, Gregor Féng wrote:
> > Hi all,
> >
> > I experiment with websocket controller and most worked so far. I can
> > send messages between chicago boss and different browsers. So far, so
> > good. What I'm missing yet is the »SessionId«, that is always
> > »undefined«. I'm using version 0.8.12 and the source of the (very
> > simple) websocket is as follow:
> >
> > ------------------------------
> > -module(spw_msgs_websocket, [Req, SessionId]).
> >
> > -behaviour(boss_service_handler).
> >
> > -export([
> > handle_broadcast/2,
> > handle_close/4,
> > handle_incoming/4,
> > handle_join/3,
> > init/0,
> > terminate/2
> > ]).
> >
> > init() ->
> > io:format("-----init~n", []),
> > {ok, []}.
> >
> > handle_join(_URL, _Pid, State) ->
> > {noreply, State}.
> >
> > handle_close(_Reason, _URL, _Pid, State) ->
> > {noreply, State}.
> >
> > handle_incoming(_URL, Pid, Message, State) ->
> > Pid ! {text, ["Answer to: " ++ Message]},
> > {noreply, State}.
> >
> > handle_broadcast(_Message, State) ->
> > {noreply, State}.
> >
> > terminate(_Reason, _State) ->
> > ok.
> > ------------------------------
> >
> > In the boss configuration is cowboy set. What's wrong with my setup?
> >
> > Thanks people!
>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/6cb82e19-3fc1-4856-a450-920ea2a3b46c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.