[Catalyst] Bug in old Advent example of async/websockets code?
Toby Corkindale
toby at dryft.net
Mon Feb 23 01:08:28 GMT 2015
Hi,
I've been trying to replicate the use of WebSockets in Catalyst, by
following the example from the Advent calendar a year and a bit ago.
ie.
https://github.com/perl-catalyst/2013-Advent-Staging/blob/master/Websocket-Echo/lib/MyApp/Controller/Root.pm
In my experience, it isn't actually working properly -- I get the
"Echo Initiated" message, but then an instant disconnect.
Looking at the code, I'm highly suspicious of the $hd variable -- it
doesn't get stored anywhere, and according to the AnyEvent docs, I
think that means it will get DESTROYed once it goes out of scope. ie.
Immediately.
That fits the behaviour I'm seeing, although I think I've had it work
for me randomly at times as well, so... I don't know.
I wondered if anyone here has thoughts on the matter?
Cheers,
Toby
More information about the Catalyst
mailing list