You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
497 B
25 lines
497 B
var express = require('express'); |
|
var expressWs = require('..'); |
|
|
|
var expressWs = expressWs(express()); |
|
var app = expressWs.app; |
|
|
|
app.use(function (req, res, next) { |
|
console.log('middleware'); |
|
req.testing = 'testing'; |
|
return next(); |
|
}); |
|
|
|
app.get('/', function(req, res, next){ |
|
console.log('get route', req.testing); |
|
res.end(); |
|
}); |
|
|
|
app.ws('/', function(ws, req) { |
|
ws.on('message', function(msg) { |
|
console.log(msg); |
|
}); |
|
console.log('socket', req.testing); |
|
}); |
|
|
|
app.listen(3000)
|
|
|