This page aims to describe the network protocol of Omegle. Omegle is a website and a mobile application that allows people to chat with random strangers. The network protocol is based on HTTP and JSON. It uses long-polling instead of websockets.

Choosing a server

Omegle has a few different servers. A client should pick a random one when connecting. The server address is http://frontX.omegle.com where X is a random number between 1 and 9.

Another way of picking a server is sending a GET request to http://omegle.com/status, parsing the JSON and picking a random server from servers.

Connecting to a server

Since the protocol is polling-based, state is maintained by getting a shard from the server when connecting and sending it back on every request. You can get this shard by sending a POST request to http://frontX.omegle.com/start with the data {"rcs": 1} and saving the shard you get in the response.

Disconnecting from the server

Disconnecting is really similar to connecting. Sending a POST request to http://frontX.omegle.com/disconnect with the data {"id": SHARD_GOES_HERE} is enough. To connect again, just get another shard by doing /start.

Sending a message

Sending messages is very important in a chat protocol. To send messages, you need to send a POST request to http://frontX.omegle.com/send with the data {"id": SHARD_GOES_HERE, "message": "Your message here!"}.

Getting events

In order to make a full chat client, you need to get events as well. These events include:

  • The other person connecting
  • The other person disconnecting
  • The other person typing a message
  • Receiving messages from the other person

To get the events, you need to send a POST request to http://frontX.omegle.com/events with the data {"id": SHARD_GOES_HERE}. In response, you will get a JSON list of events. The events are lists as well. The first member of the list is the event name and the of them are the arguments (such as the message from a message event).

Here are some of the events.

  • ["waiting"] Searching for a stranger
  • ["connected"] Found a stranger
  • ["strangerDisconnected"] The stranger disconnected
  • ["gotMessage", "Message text here"] The stranger sent a message
  • ["typing"] The stranger is typing
  • ["stoppedTyping"] The stranger stopped typing

Sending typing events

In order send the Stranger is typing notification to the other person, you can send a POST request to http://frontX.omegle.com/typing and http://frontX.omegle.com/stoppedtyping. Both of them need to have {"id": SHARD_GOES_HERE} in the post data.

Examples and more reading

Is Omegle peer-to-peer?

No, Omegle is not a peer-to-peer chat application. It communicates with a random server using JSON messages transferred over HTTP requests.

Is Omegle encrypted?

Omegle uses TLS when communicating with their servers. This means your network provider will be able to see that you are using Omegle, but not what you are typing. It is important to note that the messages are NOT end-to-end encrypted, which means Omegle is able to read everything you send and receive.