Adult chat example

The transport mechanism is the same as for authentication - a HTTP POST over XMLHttp Request with the chat message in the body.

The cookie from the authentication step is sent along, allowing the server to know who sent the message.

If you need to stream data from the server to the client, you have other options than Web Socket.

Event Source is a much simpler protocol and hopefully Webbit will make it more widely used.

Here is a comparison between the two approaches: For simplicity, neither app requires a password - the user is only presented with a popup asking for the username.

How the username is handled is different for each app: The username value is wrappend in a small JSON document: ed to the server using XMLHttp Request (AJAX).

Adult chat example-14Adult chat example-15Adult chat example-65Adult chat example-88

Subsequent requests will send this cookie along, allowing the server to associate chat messages with that user.Later, when the app grows other programs gravitate towards it and want to talk to it, and this becomes quite hard if the entire app is geared towards Web Sockets.An app using REST for client-server communication from the start is much easier to open up so other apps can integrate with it.It’s easy to create well-maintained, Markdown or rich text documentation alongside your code.Sign up for free See pricing for teams and enterprises Webbit REST contains a sample Chat Room application that implements a Chat Room using REST and Server-sent Events/Event Source in the client.

Leave a Reply