pusher / pusher-websocket-dotnet

Pusher Channels Client Library for .NET
MIT License
112 stars 113 forks source link

Keeps on throwing Pusher Cluster error and doesn't take cluster as a PusherOption #64

Closed Jordanirabor closed 5 years ago

imaji commented 5 years ago

Could you provide some more details please? Like what environment you're using, the call stack, what you're trying to do with it, maybe some code that replicate the problem.

Thanks!

Jordanirabor commented 5 years ago

I'm using it with Unity 18 and When I connect with my key, it throws this error:

Pusher: Websocket message received: {"event":"pusher:error","data":{"code":4001,"message":"App key 23919cee3b1111731271 not in this cluster. Did you forget to specify the cluster?"}} UnityEngine.Debug:Log(Object)

Jordanirabor commented 5 years ago

Here's my code:

using UnityEngine; using System.Collections; using PusherClient;

public class LobbyScript : MonoBehaviour { // isntance of pusher client PusherClient.Pusher pusherClient = null;

PusherClient.Channel pusherChannel = null;

// Initialize
void Start () {
// TODO: Replace these with your app values
PusherSettings.Verbose = true;
    PusherSettings.AppKey = "23919cee3b1111731271";

    pusherClient = new PusherClient.Pusher();
    pusherClient.Connected += HandleConnected;
    pusherClient.ConnectionStateChanged += HandleConnectionStateChanged;
    pusherClient.Connect();
}

void HandleConnected(object sender) { Debug.Log("Pusher client connected, now subscribing to private channel"); pusherChannel = pusherClient.Subscribe("private-testchannel"); pusherChannel.BindAll(HandleChannelEvent); }

void OnDestroy() { if (pusherClient != null) pusherClient.Disconnect(); }

void HandleChannelEvent(string eventName, object evData) { Debug.Log("Received event on channel, event name: " + eventName + ", data: " + JsonHelper.Serialize(evData)); }

void HandleConnectionStateChanged(object sender, PusherClient.ConnectionState state) { Debug.Log("Pusher connection state changed to: " + state); } }

Jordanirabor commented 5 years ago

I actually started building off this client as it is a wrapper that makes the integration easy to include into Unity https://github.com/MiketoString/pusher-dotnet-unity-client

Jordanirabor commented 5 years ago

I'm supposed to be writing (guest writer program) about the usage of this SDK but i'm having difficulties, help!

Thank you

imaji commented 5 years ago

So you're not using the Pusher Client Library, you're using that wrapper?

Jordanirabor commented 5 years ago

Yeah, Pretty much.

I found it very easy to integrate into Unity.