Created
August 17, 2024 13:43
-
-
Save jrichardsz/a6cd126c7ae7fc85f398e18808ff2b5c to your computer and use it in GitHub Desktop.
nodejs socketio socket.io snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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