pusher / pusher-websocket-react-native

React Native official Pusher SDK
MIT License
61 stars 52 forks source link

Private channel subscription issue #133

Open ItxAltaf opened 7 months ago

ItxAltaf commented 7 months ago

onSubscriptionSucceeded not calling on private channel

I add onAuthorizer but did not work

const onAuthorizer = async (channelName, socketId) => { console.log( calling onAuthorizer. channelName=${channelName}, socketId=${socketId}, ); var obj = { socket_id: socketId, channel_name: channelName, }; const response = await Api.post(urls.CHAT_AUTH, obj, (isChatify = true)); console.log(onAuthorizerresponse:, response); if (!isAuthenticated) { // Your authentication logic here isAuthenticated = true; return {auth:response.auth,id:'3'}; } // If already authenticated, return null or undefined return null; // return response; };

benw-pusher commented 7 months ago

Do you see any errors regarding the subscription attempt? What is the response from your auth endpoint (what does this log output console.log( onAuthorizerresponse:, response);)? For a private channel no id is required, the correct format is:

{
  "auth": "key:signature"
}