Closed ryuken closed 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.
can you add example to doc?
@chovy: Sure. Are you a maintainer of this project or are you interested in the solution? just curious :)
@hedgerh i'm interested in the solution -- I'm waiting for this module to support koa-router@7.0.1
@chovy: https://github.com/hedgerh/koa-websocket/blob/00168026e31d6f338ceee0157604e44b0e25b4f7/README.md
i may look into why its not working with koa-router
next
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
The session from koa-generic-session etc doesn't exist on the websocket side