forked from uNetworking/uWebSockets.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
// const { threadId, parentPort, workerData } = require('worker_threads')
const uWS = require('uWebSockets.js')
const port = 9000
this.open = 0
const start = (params) => {
uWS.App({})
.ws('/*', {
compression: 0,
maxPayloadLength: 16384,
idleTimeout: 32,
maxBackpressure: 66560,
open: client => {
this.open++
console.log('open ' + client)
},
message: (client, message /*, isBinary*/) => {
},
drain: client => {
console.log('drain', client, client.getBufferedAmount())
},
close: (client, code, message) => {
console.log('close')
}
})
.get('/*', (res, req) => {
res.writeStatus('200 OK').end("Eddie 'The Head' is in the house")
})
.listen(port, ws => {
console.log(`Listening to port ${port} open ${this.open}`)
})
}
start()
Source: Minimal Server Example (gist)
Metadata
Metadata
Assignees
Labels
No labels