Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

socket io nodejs

const express = require('express');const app = express();const http = require('http');const server = http.createServer(app);const { Server } = require("socket.io");const io = new Server(server);app.get('/', (req, res) => {  res.sendFile(__dirname + '/index.html');});io.on('connection', (socket) => {  console.log('a user connected');});server.listen(3000, () => {  console.log('listening on *:3000');});
Source by socket.io #
 
PREVIOUS NEXT
Tagged: #socket #io #nodejs
ADD COMMENT
Topic
Name
8+1 =