uperl / AnyEvent-WebSocket-Client

WebSocket client for AnyEvent
9 stars 10 forks source link

pass more stuff information into the on_message / on_next_message callback #8

Closed plicease closed 11 years ago

plicease commented 11 years ago

Possible things that might be of use

plicease commented 11 years ago

If anything else is passed in it should be compatible with the current implementation, so $_[0] should be the decoded message.

debug-ito commented 11 years ago

I was thinking about that, too.

I tried implementing new methods on_next_data() and on_each_data() to do a bit rawer handling of received data. Checkout https://github.com/debug-ito/AnyEvent-WebSocket-Client/tree/connection_raw_data

In on_{next,each}_data() callbacks,

But yeah, passing the connection object is a good idea (it reduces the risk of cyclic reference)

plicease commented 11 years ago

I took what you did and reworked the interface, take a look at my issue_8 branch.

Does this interface meet your needs? I haven't committed to it yet, but I think it is close to what I am thinking.

debug-ito commented 11 years ago

Yes, it meets my needs. I like the idea of on() method. Thank you!

plicease commented 11 years ago

Cool. Your test was really helped out thanks for that