After some investigation it seems this issue manifests itself only with Chrome based browsers. (mojo is v6.60)
My assumption is that server sends slightly different handshake messages when using $c->delay, and this has some profound impact on Chrome. Browser complains with: WebSocket connection to 'ws://192.168.1.10:3000/ws/new' failed: One or more reserved bits are on: reserved1 = 1, reserved2 = 0, reserved3 = 0 Here are tcpdumps for both cases, where underscored packet seems to be missing in the second dump? https://gist.github.com/mpapec/ea4b0885c3d982a1610c306976bb1dfc On Friday, April 29, 2016 at 3:20:29 PM UTC+2, Matija Papec wrote: > > > When I set websocket events inside $c->delay() browser disconnects almost > immediately ("finish" event is properly triggered). > Please explain what is wrong here. > > ====================== > use Mojolicious::Lite; > > websocket '/ws/:sessid' => sub { > my ($c) = @_; > > $c->delay(sub{ > $c->on(finish => sub { warn "disconnect\n" }); > $c->on(json => sub { warn "incoming ws json \n" }); > }); > }; > > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
