Omegle clone using SignalR
A few days ago I was looking through SignalR and I had the idea to build an Omegle clone. The Omegle one-on-one random chat have a good fit with SignalR, so I decided to try it.
Talking about my implementation in more detail, the two most important parts of my application are the SignalR Hub call ChatHub
and the chat.js
file where I added SignalR hub client connection code.
In ChatHub
the methods OnConnected
and OnDisconnected
were overridden from the Hub
base class so I could add logic for when a new user connects to chat with someone or when disconnects (abruptly or not). Every connection is stored in a static variable Chats
that are going to be deleted in case the application closes. I also created a Send
method for when an user sends a message to the other user.