-
-
Notifications
You must be signed in to change notification settings - Fork 509
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
Hi, walkor. Need PHPSocketIO secure(https) #35
Comments
You can use nginx as ssl proxy. |
Thanks for you reply . But we are developing a dating script. So all of our clients cant have nginx server. Can't we do like this as we do in node js var options = { var server = tls.createServer(options, function (res) { Thanks for you valuable reply. |
I have gone through Workerman\Worker class and i have found that stream_context_set_option() php function is being used.. I have seen in stackoverflow that we make socket ssl with this context funcitons. But i dont know exactly how. can you help me out ? |
I've tried it before. The results is workerman using nonblocking socket which seems breaks the handshake of ssl. |
Oh..then it's my bad luck.. By default socketIO creates http server.. Can i change the protocol to wss ? |
If you want to use PHPSocket.IO and need wss, using Nginx/Stunnel as ssl proxy is the only way I can think of. |
Ok. Thanks .. |
Hey, man.. |
I have solved ssl .. i have added ssl context (my self signed certificated) $context_option["ssl"] = [
But i have changed non blocking to blocking .. stream_set_blocking($this->_mainSocket, true); this will cause any performace issue ? this is working fine.. now i can use wss directly . . thanks for you awesome library. |
saikat-squareloop, Hi, can u help me, in which file u added $context_option? Can u write detailed? |
I would to know how to apply SSL directly too please |
Please refer this -- #73 |
Apply SSL directly. use Workerman\Worker;
use PHPSocketIO\SocketIO;
$context = array(
'ssl' => array(
'local_cert' => '/your/path/of/server.pem',
'local_pk' => '/your/path/of/server.key',
'verify_peer' => false,
)
);
$io = new SocketIO(2021, $context);
$io->on('connection', function($socket)use($io){
$socket->on('chat message', function($msg)use($io){
$io->emit('chat message', $msg);
});
});
Worker::runAll(); Refer #72 #71 |
Hey, That not working for https .. it works with http://yoursite.com:2020 |
That works fine for me. |
@walkor Hey, Updated it .. working now .. Thank you |
I have tried to connect HTTPS host and I am having latest phpsocket.io and workerman, but still I got below issue, can you please help me out from this? May be I missed something. JS
start.io
and
Web server:
Exception I am getting when I start:
|
$context = array(
'ssl' => array(
'local_cert' => __DIR__. '/server.pem',
'local_pk' => __DIR__ .'/server.key',
'verify_peer' => false,
)
);
//Do not set https but http.
$inner_http_worker = new Worker('http://0.0.0.0:2121', $context);
$inner_http_worker->transport = 'ssl'; $context = array(
'ssl' => array(
'local_cert' => __DIR__. '/server.pem',
'local_pk' => __DIR__ .'/server.key',
'verify_peer' => false,
)
);
// Do not set https but http.
$web = new WebServer('http://0.0.0.0:2121', $context);
$web->transport = 'ssl'; |
Thank you for the quick reply @walkor I have changed as you mentioned, please find below the structure; JS:
start.io:
start_web:
I got exception like blow:
Please help me out, thanks in advance! Edit: I have already changed some ports and exception still same. -Anand |
@walkor , it seems the server has started but still got above error and it says "Address already in use" repeatedly until I use Ctrl-C to stop it. When I tried to send a message using curl to the server while running it is not sending, it seems socket not available, curl returns 'false' after long execution time.
And, my curl to send the message:
Edit: Updated workerman version but still the same issue.
|
Yes you have another process bound to the same port 2124. |
Yes @walkor, I have changed I just need one more help to send a message to the server, as I mentioned above I am sending a message using curl and my port is And I have tried the below one too,
Can you please give me some suggestion on this? I really need this. Thanks in advance. |
Please create a new issue. |
I am developing webrtc signaling server with phpsocketio for video chat application. So i need php socket io server as secure(https).. how to make php socket io server ssl .. This library is awesome. i can't leave this because of this silly reason. please help me out. Thanks. mail Id : saikatdutta1991@gmail.com
can you please help me out ?
The text was updated successfully, but these errors were encountered: