mattstyles / koa-socket

Sugar for connecting socket.io to a koa instance
242 stars 50 forks source link

Allow a way to attach that doesn't modify listen or adds .server? #12

Closed laggingreflex closed 8 years ago

laggingreflex commented 8 years ago

I have a custom Koa wrapper extending from the original Koa class and I'm over-riding the listen function with my own, and also attaching a custom app.server.

Koa-socket doing both of those things as well interferes with my wrapper.

Would it be possible to have other ways to attach to app without modifying internals as such, like providing a way to just take app.callback() or server?

laggingreflex commented 8 years ago

How about checking to see if app.server already exists, and only creating one if it doesn't? checkout this PR

mattstyles commented 8 years ago

Yep, I agree, and the PR looks good to me.

mattstyles commented 8 years ago

All published as 4.1.0