redweb 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SocketServer.js +4 -0
- package/package.json +1 -1
package/SocketServer.js
CHANGED
|
@@ -36,6 +36,10 @@ function BaseSocketServer(server, options = {}) {
|
|
|
36
36
|
this.clients = new Map(); // Use a Map to store clients by their IP addresses
|
|
37
37
|
Object.assign(this, { ...SOCKET_OPTIONS, ...options });
|
|
38
38
|
|
|
39
|
+
this.callbacks = {
|
|
40
|
+
broadcast: (message) => this.clients.forEach(client => client.send(message))
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
this.wss.on('connection', (socket, req) => {
|
|
40
44
|
const ip = req.socket.remoteAddress;
|
|
41
45
|
console.log(`New client connected: ${ip}`);
|