You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
how to write a simple WebSocket locally in js, both the client and server side.
how to upload the server into a cloud, share it, and use it on the open web.
create a ball animation game and connect to the glitch server.
Creates a processing sketch that communicates with the WebSocket server and synchronizes data.
Create a client in C# and connect with the Glitch server.
in the vs code I open the server-echo project and in the PowerShell, I go to this path and run:
That means the server started, and I can open this WebSocket Client (Chrome extension): chrome-extension://gobngblklhkgmjhbpbdlkglbhhlafjnh/index.html
In 2 tabs, I can see the messages passed from one client sent to the server, and the server sends this to every other client.
now that a simple client is created in the js we can call and receive messages from one client to the server and to the other client.
By connection to the site Glitch, it can host and share the project online https://glitch.com/dashboard, add the server there, and correct some things, finally, it does what it was doing before but it can be shared.
In the vs code install the p5.js and the live server. By adding some code the ball game client is connected with the server on the glitch.
Created a new project in the Glitch (Website), named it ball-game-sync, then deleted everything from the files and copied - pasted mine. So now the ball game is hosted/is static on the Glitch. (https://glitch.com/edit/#!/ball-game-sync)
So now there are 2 different projects (p5.js in vs code and the processor) connected to the glitch server and each one sends the coordinates to the other.
From the above image, I will deserialize the numbers from the C# console, and by extracting these numbers we will draw something on the C# console.
Below is an image of the server in C# (left) and a client in C# (Right), but this is a 1-1 relation, which means if I open another client, these 2 clients cannot interact together but only with the server.
In the below image, the server is getting a message from one client and is able to share it with the rest in C#.
About
how to write a simple WebSocket client in C# using the WebSocketSharp library.