Skip to content

Cannot receive messages from server #408

@400ochkov

Description

@400ochkov

Hello, I want to connect to my socketio server, but didn't receive any update after connection
My code
` var client = new SocketIOClient.SocketIO("https://myserver.com", new SocketIOOptions
{
Auth = new { apiKey = "myKey" }
});
client.OnConnected += async (_, __) =>
{
Console.WriteLine("[client] connected: " + client.Id);
await client.EmitAsync("subscribe", new { chapter = "myChapter", category = "myCategory" });
Console.WriteLine("[client] subscribe sent");
};

client.OnDisconnected += (_, reason) =>
{
Console.WriteLine("[client] disconnected: " + reason);
};

client.On("news", resp =>
{
Console.WriteLine("[client]: " + resp);
});`

Just see in console messages like
[client] connected: Edn7B4EXNz1vNGYEAAAZ
[client] subscribe sent
and didn't receive any news

But my socketio server works good, because I have same script on python with socketio lib and it works perfect, I use similar methods to subscribe and handle updates on it with same event name
` def subscribe(self, chapter, category):
subscription = {
'chapter': chapter,
'category': category
}
self.sio.emit('subscribe', subscription)

@self.sio.event
def news(data):
print(f"{datetime.now().isoformat(sep=' ', timespec='milliseconds')} - news received {data}")
`

I tried last version from nuget and also download project from github and make dll but result is the same

Moreover I open Charles Debugging Proxy and see that connection established and news are coming, but cant get it via any SocketIOClient's handlers. Trying to use client.OnAny but it didn't work too

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions