Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

socket io express

const app = require("express")();const httpServer = require("http").createServer(app);const options = { /* ... */ };const io = require("socket.io")(httpServer, options);io.on("connection", socket => { /* ... */ });httpServer.listen(3000);// WARNING !!! app.listen(3000); will not work here, as it creates a new HTTP server
Source by socket.io #
 
PREVIOUS NEXT
Tagged: #socket #io #express
ADD COMMENT
Topic
Name
4+2 =