Hi,

first of all, which CB version you are using?

On Wednesday, November 18, 2015 at 12:21:51 PM UTC+2, Mert Öztürk wrote:
>
> Hello,
>
> I am trying to get hostname with websocket connection on the following 
> function: handle_join(ServiceName, WebSocketId, State)
> I tried with 
>  Req:header(host), Req:header(hostname), Req:header("host"), 
> Req:header("hostname"), 
> but i get the following error;
>
> tt_service_websocket (<0.1698.0>) starting...
> 12:01:52.853 [error] ** Boss Service Handler tt_service_websocket 
> terminating in join/0
>    for the reason error:undef
> ServiceUrl: "/websocket/service"
> WebSocketId: <0.1696.0>
> SessionId  : undefined
> State    : 
> {state,{dict,0,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}}
> ** Stacktrace: 
> [{http_req,header,[host,{http_req,#Port<0.39188>,ranch_tcp,keepalive,<0.1696.0>,<<"GET">>,'HTTP/1.1',{{127,0,0,1},52131},<<"localhost">>,undefined,8001,<<"/websocket/service">>,undefined,<<>>,undefined,[],[{<<"host">>,<<"localhost:8001">>},{<<"connection">>,<<"Upgrade">>},{<<"pragma">>,<<"no-cache">>},{<<"cache-control">>,<<"no-cache">>},{<<"upgrade">>,<<"websocket">>},{<<"origin">>,<<"
> http://localhost:8001";>>},{<<"sec-websocket-version">>,<<"13">>},{<<"user-agent">>,<<"Mozilla/5.0
>  
> (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) 
> Chrome/46.0.2490.80 Safari/537.36">>},{<<"accept-encoding">>,<<"gzip, 
> deflate, 
> sdch">>},{<<"accept-language">>,<<"en-US,en;q=0.8">>},{<<"cookie">>,<<"_ga=GA1.1.93174808.1447451951">>},{<<"sec-websocket-key">>,<<"olKXNasMxISW/Xn6fPZ9Yg==">>},{<<"sec-websocket-extensions">>,<<"permessage-deflate;
>  
> client_max_window_bits">>}],[{<<"sec-websocket-extensions">>,[{<<"permessage-deflate">>,[<<"client_max_window_bits">>]}]},{<<"upgrade">>,[<<"websocket">>]},{<<"connection">>,[<<"upgrade">>]}],undefined,[{websocket_compress,false},{websocket_version,13}],waiting,undefined,<<>>,false,waiting,[],<<>>,undefined}],[]},{tt_service_websocket,handle_join,4,[{file,"c:/Users/Asus/Desktop/tt/src/websocket/tt_service_websocket.erl"},{line,23}]},{boss_service_worker,handle_cast,2,[{file,"src/boss/boss_service_worker.erl"},{line,123}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,599}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]
>
> 12:01:52.853 [error] gen_server tt_service_websocket terminated with 
> reason: bad return value: ok
> 12:01:52.853 [error] CRASH REPORT Process <0.1686.0> with 0 neighbours 
> exited with reason: bad return value: ok in gen_server:terminate/6 line 737
> 12:01:52.853 [error] Supervisor {global,boss_service_sup} had child 
> tt_service_websocket started with 
> boss_service_worker:start_link(tt_service_websocket, 
> <<"/websocket/service">>) at <0.1686.0> exit with reason bad return value: 
> ok in context child_terminated
>
> I think i get the cowboy req object in the error code. Is there a correct 
> way to get hostname through websocket connection and use it in my websocket 
> service code as a security and confirmation?
>
> Thanks
> Mert
>
>
>
>
>

-- 
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/755c8209-ee76-4824-9b99-dd4db161bbb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to