Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client does not hook "on" event #2

Closed
fob71 opened this issue Aug 6, 2019 · 2 comments
Closed

Client does not hook "on" event #2

fob71 opened this issue Aug 6, 2019 · 2 comments

Comments

@fob71
Copy link

fob71 commented Aug 6, 2019

When I listen an event with:

        // Listen server events
        client.On("ws_message-new", res =>
        {
            Console.WriteLine("WS from server" + res.Text);
        });

It does not work.

Issue (I think) it's related to line 186 in https://github.com/doghappy/socket.io-client-csharp/blob/master/SocketIOClient/SocketIO.cs:
...
else if (_parserRegex.IsMatch(text))
...

I see how message arrives ( in my sample, I receive: "42["ws_message-new","message from server"]" ), but it's not hooked by "on" method.

I use the following versions:
node: v10.16.0
socket.io: 2.2.0
express: 4.17.1

@doghappy
Copy link
Owner

doghappy commented Aug 6, 2019

@fob71 fix :)

_parserRegex = new Regex("^42" + _namespace + @"\[""([\s\w-]+)"",([\s\S]*)\]$");

@fob71
Copy link
Author

fob71 commented Aug 6, 2019

it works fine.... thanks a lot

@fob71 fob71 closed this as completed Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants