kudos / koa-websocket

Light wrapper around Koa providing a websocket middleware handler that is koa-route compatible.
MIT License
259 stars 37 forks source link

no session #10

Closed ryuken closed 8 years ago

ryuken commented 8 years ago

The session from koa-generic-session etc doesn't exist on the websocket side

hedgerh commented 8 years ago

For anyone else wondering, I believe you need to pass the session store to both app.use and app.ws.use. The websocket object seems to have middleware separate from the koa app.

ralyodio commented 8 years ago

can you add example to doc?

hedgerh commented 8 years ago

@chovy: Sure. Are you a maintainer of this project or are you interested in the solution? just curious :)

ralyodio commented 8 years ago

@hedgerh i'm interested in the solution -- I'm waiting for this module to support koa-router@7.0.1

hedgerh commented 8 years ago

@chovy: https://github.com/hedgerh/koa-websocket/blob/00168026e31d6f338ceee0157604e44b0e25b4f7/README.md

i may look into why its not working with koa-router next

ralyodio commented 8 years ago

The only comment I have on your example for routes is you might want to put a fake route like /foo so you can see how /foo is mapped on the backend and the front-end. It wasn't obvious at first glance how you use the route on the client side.

I believe the koa-router@7 issue is here: https://github.com/kudos/koa-websocket/blob/master/index.js#L27