1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-27 13:48:49 +08:00
Mainflux.mainflux/wsServer.js
Drasko DRASKOVIC cf17b53bb6 Add MQTT, HTTP and WS API servers
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2016-04-27 23:05:42 +02:00

26 lines
619 B
JavaScript

/**
* Copyright (c) Mainflux
*
* Mainflux server is licensed under an Apache license, version 2.0 license.
* All rights not explicitly granted in the Apache license, version 2.0 are reserved.
* See the included LICENSE file for more details.
*/
var WebSocketServer = require('ws').Server
, wsServer = new WebSocketServer({ port: 5152 });
wsServer.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
});
ws.send('something');
});
console.log('WS magic happens on port 5152');
/**
* Exports
*/
module.exports = wsServer;