Skip to content

ws porotocol is open but client log ERR_CONNECTION_RESET #345

@doyoque

Description

@doyoque

I was developing real-time order features with Laravel framework. I've come from Ratchet implementation then I find out Thruway because it using WAMP2 and compatible with latest autobahn.js (I'm using this #96 as implementation in backend). Everything seems work in local development. Then the issue come in when we have an AWS ec2 as the server. We use nginx as demo server.

Here's the log when I run as artisan command in the server:

2020-08-24T12:43:28.8674370 debug      [Thruway\Peer\Router 11022] New router created
2020-08-24T12:43:28.8687710 info       [App\Http\Controllers\PusherController 11022] New client created
2020-08-24T12:43:28.8723740 info       [Thruway\Peer\Router 11022] Starting router
2020-08-24T12:43:28.8758080 info       [Thruway\RealmManager 11022] Got prehello...
2020-08-24T12:43:28.8760710 debug      [Thruway\RealmManager 11022] Creating new realm 'realm1'
2020-08-24T12:43:28.8779930 debug      [Thruway\RealmManager 11022] Adding realm 'realm1'
2020-08-24T12:43:28.8794390 debug      [App\Http\Controllers\PusherController 11022] Client onMessage: [Thruway\Message\WelcomeMessage]
2020-08-24T12:43:28.8796240 info       [App\Http\Controllers\PusherController 11022] We have been welcomed...
2020-08-24T12:43:28.8818260 info       [Thruway\Transport\RatchetTransportProvider 11022] Websocket listening on 0.0.0.0:9000
2020-08-24T12:43:28.8825020 info       [Thruway\Peer\Router 11022] Starting loop

I guess the server is already open the ws:// protocol. Also here's the client side code:

let conn = new autobahn.Connection({ url: 'ws://127.0.0.1:8080', realm: 'realm1' });
let merchId = $('#realtime_contents').data('merchantid');

conn.onopen = function (session) {
    function onevent(args) {
        sectionOrder(args[0].order, true);
        get_notification_number();
    }

    session.subscribe(merchId.toString(), onevent);
};

But then when I check out the devtool the client throws a error.
Screenshot from 2020-08-24 10-58-22

Is there's any misconfiguration or something wrong in my client code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions