Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrichardsz/a6cd126c7ae7fc85f398e18808ff2b5c to your computer and use it in GitHub Desktop.
Save jrichardsz/a6cd126c7ae7fc85f398e18808ff2b5c to your computer and use it in GitHub Desktop.
nodejs socketio socket.io snippets
const express = require('express');
const fs = require('fs')
const path = require('path')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server,{maxHttpBufferSize: 1e7})
io.on('connection', function (socket) {
console.log("headers at connection:")
console.log(socket.handshake.headers)
});
server.listen(3000)
console.log("Running on port: "+3000)
//npm install express socket.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment