Skip to content

v1.2.0

Choose a tag to compare

@ipakhomov ipakhomov released this 01 Dec 12:08
· 55 commits to main since this release

What's Changed

Pusher websockets utilities change

  1. WebSocketService now requires calling init() before connect() as per Pusher docs.
    The init() method now can accept:
  • a token getter function for dynamic token retrieval, ensuring the latest authentication token is always used;
  • set of handlers to pass callbacks into pusher client instance

Migration:

// Before
await webSocketService.connect('your-auth-token');

// After
const tokenGetter = () => getAuthToken(); // Function that returns current token
await webSocketService.init(tokenGetter, {
    // Optional handlers
    onConnectionStateChange: (currentState) => {
      // Do something with the connection state
    },
  }
);
webSocketService.connect();
  1. Added new hook usePusherReactNative that automatically manages WebSocket connection lifecycle for React Native apps.

Full Changelog: v1.1.0...v1.2.0