| 252 | } |
| 253 | |
| 254 | function initWebsocket(wss, withIDE:boolean) { |
| 255 | wss.on('connection', function connection(ws) { |
| 256 | let client = new SocketRuntimeClient(ws, withIDE); |
| 257 | let handler = withIDE ? IDEMessageHandler : MessageHandler; |
| 258 | if(!withIDE) { |
| 259 | // we need to initialize |
| 260 | } |
| 261 | ws.on('message', (message) => { |
| 262 | handler(client, message); |
| 263 | }) |
| 264 | ws.on("close", function() { |
| 265 | if(client.evaluation) { |
| 266 | client.evaluation.close(); |
| 267 | } |
| 268 | }); |
| 269 | }); |
| 270 | } |
| 271 | |
| 272 | //--------------------------------------------------------------------- |
| 273 | // Go! |