kinabalu / websocketsbook Goto Github PK
View Code? Open in Web Editor NEWWebSockets book
WebSockets book
It is not made clear how to run the code. The only hint for running code is node server.js
then it tells you to run the client.html. However as far as i can see there is no server running to serve the html file. What i did was split the two elements of code in ch1 and ch1html into two directories then run node server.js
in one terminal and open a new terminal and fire up http-server
(on :8081) which is a simple http server in node. This worked inasmuch as the socket wrote out to the terminal, not the console log.
Now i wouldn't expect console output to com from the the http running on port 8081 so i ran the console from 8181 the server.js. No console output and two error messages Failed to load resource: the server responded with a status of 426 (Upgrade Required)
which i am still trying to work out as i have got the latest node and nam installed.
When I shutdown the server in ch03/notifications the closeSocket() from "process.on" handler called.
Basically what is the value of the "client_uuid" in this case ? Please note that I am stopping the server and not just particular browser client. In my case I am seeing that the client id (client_uuid) is always the first client which is connected to the server. Why it is the case ? Can you please explain ?
Note: Actually this is not an issue but a question and I thought that using github is the fastest mode to get the response from the author. Please excuse me.
Thanks & Regards,
Mohamed
When on page http://localhost:8181 browser shows "Upgrade Required".
In console there is: Failed to load resource: the server responded with a status of 426 (Upgrade Required), and GET http://localhost:8181/ 426 (Upgrade Required).
Hello~
First thanks for your knowledge sharing in your book, it helps me a lot to understand websocket~~
But I found a little mistake here on page 15, it says "PING frames are sent out by the server only, and browser implementations should send back PONG frames in response."
in mdn, it says that "At any point after the handshake, either the client or the server can choose to send a ping to the other party."
Wish your book is getting better and better
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.