Skip to content

Commit 6aa92de

Browse files
authored
init
1 parent 1802a4a commit 6aa92de

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
61.9 KB
Loading
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: Admin UI
3+
description: This article explains how to use Admin UI when you're using Web PubSub for Socket.IO.
4+
keywords: Socket.IO, Socket.IO on Azure, multi-node Socket.IO, scaling Socket.IO, Socket.IO logging, Socket.IO debugging, socketio, azure socketio
5+
author: xingsy97
6+
ms.author: siyuanxing
7+
ms.date: 07/02/2024
8+
ms.service: azure-web-pubsub
9+
ms.topic: how-to
10+
---
11+
12+
[Socket.IO Admin UI](https://socket.io/docs/v4/admin-ui/) is a website tool developed by Socket.IO offical team and it can be used to have an overview of the state of your Socket.IO deployment. See how it works and explore its advanced usage in [Socket.IO Admin UI Doc](https://socket.io/docs/v4/admin-ui/).
13+
14+
[Azure Socket.IO Admin UI](https://github.com/Azure/azure-webpubsub/tree/main/tools/azure-socketio-admin-ui) is a customized version of it for Azure Socket.IO.
15+
16+
# Deploy the website
17+
Azure Socket.IO Admin UI doesn't have a hosted version so far. Users should host the website by themselves.
18+
19+
The static website files could be either downloaded from release or built from source code:
20+
21+
## Download the released version
22+
1. Download the released zip file such as `azure-socketio-admin-ui-0.1.0.zip` from [release page](https://github.com/Azure/azure-webpubsub/releases)
23+
24+
2. Extract the zip file
25+
26+
## Build from source code
27+
1. Clone the repository
28+
```bash
29+
git clone https://github.com/Azure/azure-webpubsub.git
30+
```
31+
32+
2. Build the project
33+
```bash
34+
cd tools/azure-socketio-admin-ui
35+
yarn install
36+
yarn build
37+
```
38+
39+
3. Host the static files using any HTTP server. Let's use [a simple static HTTP server](https://www.npmjs.com/package/http-server) as an example:
40+
```bash
41+
cd dist
42+
npm install -g http-server
43+
http-server
44+
```
45+
46+
The http server is hosted on port 8080 by default.
47+
48+
4. Visit `http://localhost:8080` to view the website.
49+
50+
# Service-side
51+
1. install the `@socket.io/admin-ui` package:
52+
53+
```bash
54+
npm i @socket.io/admin-ui
55+
```
56+
57+
2. Invoke the instrument method on your Socket.IO server:
58+
59+
```javascript
60+
const azure = require("@azure/web-pubsub-socket.io");
61+
const { Server } = require("socket.io");
62+
const { instrument } = require("@socket.io/admin-ui");
63+
const httpServer = require('http').createServer(app);
64+
65+
const wpsOptions = {
66+
hub: "eio_hub",
67+
connectionString: process.argv[2] || process.env.WebPubSubConnectionString
68+
};
69+
70+
const io = await new Server(httpServer).useAzureSocketIO(wpsOptions);
71+
instrument(io, { auth: false, mode: "development" });
72+
73+
// Note: The next three lines are necessary to make the development mode work
74+
Namespace.prototype["fetchSockets"] = async function() {
75+
return this.local.fetchSockets();
76+
};
77+
78+
httpServer.listen(3000);
79+
```
80+
81+
# Client Side
82+
1. Visit `http://localhost:8080` in browser.
83+
84+
2. You should see the following modal:
85+
86+
:::image type="content" source="./media/socketio-troubleshoot-admin-ui/admin-ui-homepage-modal.png" alt-text="Modal of Socket.IO Admin UI Homepage.":::
87+
88+
3. Fill in your service endpoint and hub name.

0 commit comments

Comments
 (0)