-
Notifications
You must be signed in to change notification settings - Fork 184
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
how to use https connection #30
Comments
Use HTTPS in the URL. |
unable to connect, there is no any console message, i tried without ssl it works but this is not.
I also tried this one too
|
Remove 'polling'.
And check your socket.io server, you should enable SSL, If I Remember
correctly the parameter is secure:true
|
our server is already ssl ready, we use in angular to connect socket it works with ssl but unable to connect with this library |
@godlessturtle you need a socket.io server, which angular library are you using? |
On a related topic, I am trying to use the options param, but there's no reference for it. For my server I need to include the transport as polling & to add I tried the same code
P.S: I am actually porting a JS library to Dart. |
Here is my test code to access our https://keikai.io demo and it works well with IO client.
The console printed as follows:
Note: if you are using browser client, you don't need to specify the |
What if I have Authorization Headers? |
@assemmarwan it seems not porting yet. https://github.com/rikulo/socket.io-client-dart/blob/master/lib/src/engine/transport/xhr_transport.dart#L177-L182 |
I would love to contribute 😀 |
adhara socket io |
Finally it worked, although it doesn't make sense in my opinion. Here's what I had to do: _socket = io(url, <dynamic, dynamic>{
'path': path,
'transportOptions': <String, dynamic>{
'polling': <String, String>{
'extraHeaders': 'Token <token>'
}
}
}); The equivalent in JS: this.socket = IO.connect(args.url, {
secure: args.url.split("/")[0] === "https:",
path: args.path,
transportOptions: {
polling: {
extraHeaders: headers
}
}
}); I believe there's a bug with handling the extraHeaders, because I am passing the value without the key 🤷♂️ |
Hi all, I created a socket.io server in nodejs which allows for HTTPS connection with a self signed certificate. I am trying to get the socket.io client in dart to successfully connect to the server using HTTPS. I have tested the socket.io client in nodejs for HTTPS and it successfully connected. My client code for dart is
But at the server side I cannot see any client connected. |
i created a class, and solved my problem approx. 2 months ago
|
@assemmarwan #34 has supported, please help me to test if it works, thanks. |
@jumperchen I apologize for not responding earlier, but I didn't get a notification 😅 Just upgraded to For reference, here's what I changed vs. what I previously had. v0.9.4 _socket = io(url, <dynamic, dynamic>{
'path': path,
'transportOptions': <String, dynamic>{
'polling': <String, String>{
'extraHeaders': {{JWTTOKEN}}
}
}
}); v0.9.7+1 _socket = io(url, <dynamic, dynamic>{
'path': path,
'transports': ['websocket'],
'extraHeaders': <String, String>{
'Authorization': {{JWTTOKEN}}
}
}); |
how to create a secure connection with https
EDIT: solved now, check my answers below
The text was updated successfully, but these errors were encountered: