Skip to main content

Overview

About the app

A simple real-time chat app demonstrating the use of JavaScript server SDK provided by Azure Web PubSub

Azure Web PubSub enables

  • Simple real-time chat between server and client

How it works?

Server side

Serve a static web page public/index.html A REST API  /negotiate which returns a url to connect to Web PubSub
  • A simple Express server that serves a static web page public/index.html
  • A REST API /negotiate which returns a url to connect to Web PubSub
  • Listens for an onConnected event to broadcast the joining of chat participants.
  • Listens for an message event to broadcast a use's chat message to all participants in a hub.

Client side

  • Using WebSocket API to initiate a WebSocket connection and listen for an onmessage event to render chat messages in the browser.