Hi, I am trying to use Engine.IO. As stated here, StackOverflow expects to use the low level version of Socket.IO. It should also be better and newer. It should also give me the ability to easily exchange messages between the browser client and the Node.js server. Doh.I read from top to bottom these two pages:
https://github.com/LearnBoost/engine.io
https://github.com/learnboost/engine.io-client
But it doesnβt help, these manuals seem to be written for those who already know how to use this technology not for those who are trying to learn it. Even the main parts are missing.
How is the client script supposed to get into the browser?
What is the landing address for "hello world" that I have to enter in the browser?
Step-by-step instructions for getting started?
Please, help! Itβs not easy when you try to learn something like that!
This should be a client script:
<script src="/path/to/engine.io.js"></script>
<script>
var socket = new eio.Socket('ws://localhost/');
socket.on('open', function () {
socket.on('message', function (data) { });
socket.on('close', function () { });
});
</script>
But what is it? Index.html? What does all of this mean? How to use it?
Now here is the "server" part:
(A) Listening on a port
var engine = require('engine.io')
, server = engine.listen(80)
server.on('connection', function (socket) {
socket.send('utf 8 string');
});
(B) Intercepting requests for a http.Server
var engine = require('engine.io')
, http = require('http').createServer().listen(3000)
, server = engine.attach(http)
server.on('connection', function (socket) {
socket.on('message', function () { });
socket.on('close', function () { });
});
(C) Passing in requests
var engine = require('engine.io')
, server = new engine.Server()
server.on('connection', function (socket) {
socket.send('hi');
});
httpServer.on('upgrade', function (req, socket, head) {
server.handleUpgrade(req, socket, head);
});
httpServer.on('request', function (req, res) {
server.handleRequest(req, res);
});
Why is it broken into three parts? Which one matches the client example? Maybe I sound stupid, but how to get a "hello world"?