@eleven-am/pondsocket 0.1.47 → 0.1.48

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/client/channel.js CHANGED
@@ -159,6 +159,12 @@ class Channel {
159
159
  onUsersChange(callback) {
160
160
  return this._subscribeToPresence((_event, payload) => callback(payload.presence));
161
161
  }
162
+ /**
163
+ * @desc Gets the current connection state of the channel.
164
+ */
165
+ isConnected() {
166
+ return this._joinState.value === enums_1.ChannelState.JOINED || this._joinState.value === enums_1.ChannelState.JOINING;
167
+ }
162
168
  _send(event, payload, receivers = 'all_users') {
163
169
  const message = {
164
170
  action: enums_1.ClientActions.BROADCAST,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
package/types.d.ts CHANGED
@@ -191,6 +191,11 @@ export declare class Channel {
191
191
  * @param callback - The callback to call when the presence changes.
192
192
  */
193
193
  public onUsersChange(callback: (users: PondPresence[]) => void): Unsubscribe;
194
+
195
+ /**
196
+ * @desc Gets the current connection state of the channel.
197
+ */
198
+ public isConnected (): boolean;
194
199
  }
195
200
 
196
201
  declare class PondSocketClient {