7.2 How to Create a WebSocket Client in C# - Fun with WebSockets!
HTML-код
- Опубликовано: 11 сен 2024
- In this video, I explain how to write a simple WebSocket client in C# using the WebSocketSharp library.
This video is part of the series "Fun with WebSockets! 🌐🔌", taught by @garciadelcastillo on @ParametricCamp.
📝Course playlist: • Fun with WebSockets! 🌐🔌
Remember to subscribe and turn notifications on to receive alerts for new streams and content! 😄
💻Code: github.com/Par...
🔗 Websocket Echo Server on Glitch.com: glitch.com/edi...
🔗 p5.js Sketch: editor.p5js.or...
🔗 p5.js Sketch on Glitch.com: glitch.com/edi...
Follow:
📺 / parametriccamp
📷 / parametriccamp
🐦 / parametriccamp
💻github.com/Par...
📷🕺 / garciadelcastillo
🐦🕺 / garciadelcasti
📼✂️🕺Video editing: / kh.arastoo
after 2 hours trying of different approaches your solution is WORKing for me, thank you!
I'm doing my senior thesis (real time chat) and you helped me a lot with understanding WebSockets. Thank you from all of my heart
Exactly what I was looking for and presented excellently. Thank you!
The best coding explanation ever, the way you break down the smaller concepts makes it super easy. Thanks for sharing.
Sir, you are a life saver. I am working on a project for a client and they require something very similar to this.
Thank you thank you thank you !! I cannot tell you how many hours I've spent looking for a websocket client example in C#. This video is just what I needed to get started, and I followed your example to the letter with the exception that I wanted to use a wss:// stream, and it works great! I've subscribed and will be checking all the related videos. Big thanks again!
You know, I read somewhere "“Simple is power. Simplicity comes out from the synthesis of experience and wisdom. Simple is natural, easy, nice, unpretentious.”
: By Alex Rovira" . Your teaching style is wonderful. Thank you.
It helped me a lot not only to implement WS server and client, but also to understand these principles in general. Big thanks to you!
awesome video Luis! I love your english and the way you explain everything.
Thanks brother , greatings from Dominican Republic
This is what I was looking for... THANK YOU SO MUCH!!
i realize I'm quite off topic but do anyone know of a good place to watch new movies online?
@Gordon Bentley i would suggest Flixzone. Just google for it :)
You are really perfect man, you saved me from my nightmares
Amazing tutorial, simple and straight forward. Now, I am having deficulty streaming using "auth token"
Great Work sir. Thank you.
I enjoyed in watching this tutorial, thanks.
thank you!! this was super helpful
Hi! Very useful video! I still have two unresolved issues:
1) How do I send a message from the server to one specific client? For example, I want a message from the server to come only to one client, and not to all.
2) The client can only accept the 'message' event. Then how do I implement chat rooms?
THANX!
Awesome video, i really enjoyed this video.
Thank for the video, this saved many time
Well explained ✌✌
Is this code will work if the client is windows service bcs I am able to send message from windows service to websocket server but unable to receive data from server to client written in windows service
very well explained thank you
can you tell which library is better websocket-sharp or websocket4net both performance and stability wise?
WebSocketSharp-NonPreRelease is deprecated. Is there another NuGet package I should use instead?
Thanks, What if i need to make a secure connection over TLS?
Do you have to manually implement a heartbeat?
I suggest making a video using Signal R
The WebSocket class implements IDisposable, but for some reason I cannot call Dispose on my WebSocket object. I get a compiler error: "CS1061 'WebSocket' does not contain a definition for 'Dispose'" How is that possible?
🎯 Key Takeaways for quick navigation:
00:00 📚 The video teaches how to create a WebSocket client in C# to connect to a WebSocket server and exchange information.
01:58 📦 The "WebSocketSharp" library simplifies WebSocket communication in C#, making it easier to work with web sockets.
03:25 🛠️ The library can be added via NuGet, simplifying the process of incorporating external dependencies into a project.
07:46 📡 The video demonstrates connecting the WebSocket client to a server and sending/receiving messages.
12:12 🔄 Utilizing event handlers in C# allows efficient handling of WebSocket client events like receiving messages from the server.
Made with HARPA AI
What is the best library for dotnet core to connect websocket??
Can you also show how to use it with a certificate? I looked at the git repo but it is a bit vague. It works when I use it with a c# server-client but it doesn't work anymore when I use html (js).
Does scope only works with "using" or is it possible that we make a non static class where we call the websocket from, would this in this way be still scoped and not stay in memory? thanks
This lib is not compatible with C# 9.0
Sir Please suggest any video for secure web socket as a server in C#.
Ur the best
i use the class library to make a plugin unity and i use .NET core 3.1 to send a websocket. when i make the both with .NET core 3.1 i have this error:
Assembly 'Assets/Scenes/MonProjet.dll' will not be loaded due to errors: Unable to resolve reference 'websocket-sharp'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector.,i use the class library to make a plugin unity and .NET core 3.1 to send a websocket. when i make the both with .NET core 3.1 i have this error:
Assembly 'Assets/Scenes/MonProjet.dll' will not be loaded due to errors: Unable to resolve reference 'websocket-sharp'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector.
Have you any idea how to resolve that, please?
Yeah. The creator of this library created a paid Unity version. If the free version is used, it somehow creates a compile error. And even if you do have money, tough - it's delisted.
@@tadeuszlorkowski1096thank thank you for your reply, I have used an other one and it worked.
@@salmidjedjiga609 Hello! would u tell me which one is the one compatible with unity? ty btw!
Isn't WebSocket an abstract class?
Hi Thanks for the video . I have requirement on sending Token to the service using client socket . can you share some code on how to attach Token value with subscription ?
Is there a way to implement this on web api controller rather than a console app?
not working to blazor-wasm pls fix
Hola! Do you know if it would be possible to create a websocket client in a ASP.NET MVC web application??
WHICH IDE IS BEING USED?
Hi!
I've done the same things you did but the websocket client just close the connection to the server, (prabably cause of the server that doesnt send data each second but i dont know), what should i do?
Thanks
You may want to join our Discord and post questions there, see if anyone can help you :)
Hi, Can you please tell me regarding wss connection which is secure with browser clients? Requirement is create websocket sharp server with certificate and browser client connect to this server.
I am also looking for wss connection Tutorial
Does this work with dotnet 5 ?
مرحبا جماعة الDIS
فصل 2021-1
@ParametricCamp.
not working with WSS
any idea how to use Authorization token using this library?
i am getting this error
without using Authorization Token
"Fatal|WebSocket.connect:0|WebSocketSharp.WebSocketException: An error has occurred during a TLS handshake. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The function requested is not supported"
great tutorial, but I have a big problems using websocket in my nginx server with https >.
i just want a good tutorial about websockets with .netframe work with no extra libraries. does anyone know/suggest one? (the websocketSharp on this video is already seems to be deprecated.