I encounter a websocket 500 error

When i create consumer exec this line

this->SetupTransport(“client”, localSdpObject);

r.status_code = 500
r.text Error: connect() already called OnConnect

Please, you must provide MUCH more details if you want to get help. We cannot figure out every issue you have when building your own application.

I assume such a “500 Error: connect() already called” is generated by the server, so you are calling twice to transport.connect() in mediasoup, which is a bug. But there is documentation about it that you must read.