Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Unable to make socket.io working on AWS EC2

 https://mydoamin.com:2120/socket.io/?EIO=3&transport=polling&t=NQpMyRI net::ERR_TIMED_OUT
i.create @ socket.io.js?v=1609310849:7

Localhost everything working fine the way it should be working but on live environment, I am getting above error.

When I connect using [workerman][1] and starting it using CLI on was ubuntu instance it is working fine

Somehow ports are not working properly even I have added it in security groups under inbound settings:-

And now this error after configuring:

<?php
use krisswebMsgSenderWebMsgSender;

return [
   'components' => [
       // others
       WebMsgSender::COMPONENT_NAME => [
           'class' => WebMsgSender::class,
           'pushApiClientHost' => '0.0.0.0',
           'logCategory' => 'webMsgSender',
       ],
   ],
];

New error

socket.io.js?v=1609310849:7 GET https://myDoamin.com:2120/socket.io/?EIO=3&transport=polling&t=NQpU3PA net::ERR_CONNECTION_RESET

Extension I am using


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
311 views
Welcome To Ask or Share your Answers For Others

1 Answer

Make sure you configure socket io to listen to be bonded to all IP addresses, not just the localhost

so instead of

<?php
use krisswebMsgSenderWebMsgSender;

return [
    'components' => [
        // others
        WebMsgSender::COMPONENT_NAME => [
            'class' => WebMsgSender::class,
            'pushApiClientHost' => 'localhost',
            'logCategory' => 'webMsgSender',
        ],
    ],
];

change to

<?php
use krisswebMsgSenderWebMsgSender;

return [
    'components' => [
        // others
        WebMsgSender::COMPONENT_NAME => [
            'class' => WebMsgSender::class,
            'pushApiClientHost' => '0.0.0.0',
            'logCategory' => 'webMsgSender',
        ],
    ],
];

basically change localhost to 0.0.0.0


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...