Is there a good starter tutorial combining socket.io and express using Express 3.x?
Actually a simple chat application would be great.
The less lines of code it uses the better.
Socket.IO can be used based on the Express server just as easily as it can run on a standard Node HTTP server. In this section, we will fire the Express server and ensure that it can talk to the client side via Socket.IO.
Setting the socket to be secured is done by: setting the secure flag - as you wrote ({secure: true}) OR by using https protocol when creating the server (instead of http) - which will set the secure flag to be true automatically.
You can check any 2.x tutorial and change the way to start the server as this post explains: socket.io.js not found
2.X.X
var app = require('express').createServer();
var io = require('socket.io').listen(app);
app.listen(10000);
3.X.X
var express = require('express')
, http = require('http');
var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);
server.listen(10000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With