Skip to content

Instantly share code, notes, and snippets.

@wyqydsyq
Last active March 29, 2018 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wyqydsyq/dba18eef9ea06b06a108fc6f6ed2f803 to your computer and use it in GitHub Desktop.
Save wyqydsyq/dba18eef9ea06b06a108fc6f6ed2f803 to your computer and use it in GitHub Desktop.
koa-ws.ts
import * as Koa from 'koa'
import * as KoaWebsocket from 'koa-websocket'
import uuid from 'uuid/v4'
const app = KoaWebsocket(new Koa())
app.ws.use(function(ctx) {
console.log('1')
const id = uuid()
console.log('2') // never logs
})
app.listen(config.port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment