Skip to content

Commit

Permalink
docs(examples): update examples to Socket.IO v3
Browse files Browse the repository at this point in the history
Other examples need some additional work (Redis adapter migration, ...).
  • Loading branch information
darrachequesne committed Nov 9, 2020
1 parent f62f180 commit d00c0c0
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 569 deletions.
2 changes: 1 addition & 1 deletion examples/chat/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Socket.IO Chat

A simple chat demo for socket.io
A simple chat demo for Socket.IO

## How to use

Expand Down
16 changes: 8 additions & 8 deletions examples/chat/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Setup basic express server
var express = require('express');
var app = express();
var path = require('path');
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var port = process.env.PORT || 3000;
const express = require('express');
const app = express();
const path = require('path');
const server = require('http').createServer(app);
const io = require('socket.io')(server);
const port = process.env.PORT || 3000;

server.listen(port, () => {
console.log('Server listening at port %d', port);
Expand All @@ -15,10 +15,10 @@ app.use(express.static(path.join(__dirname, 'public')));

// Chatroom

var numUsers = 0;
let numUsers = 0;

io.on('connection', (socket) => {
var addedUser = false;
let addedUser = false;

// when the client emits 'new message', this listens and executes
socket.on('new message', (data) => {
Expand Down

0 comments on commit d00c0c0

Please sign in to comment.