Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

socket io nodejs

import { Server } from "socket.io";

const io = new Server(3000);

io.on("connection", (socket) => {
  // send a message to the client
  socket.emit("hello from server", 1, "2", { 3: Buffer.from([4]) });

  // receive a message from the client
  socket.on("hello from client", (...args) => {
    // ...
  });
});
Source by socket.io #
 
PREVIOUS NEXT
Tagged: #socket #io #nodejs
ADD COMMENT
Topic
Name
1+9 =