[Catalyst] Bug in old Advent example of async/websockets code?

Toby Corkindale toby at dryft.net
Mon Feb 23 01:08:28 GMT 2015

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.

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.

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?


More information about the Catalyst mailing list