sepfy / libpeer

WebRTC Library for IoT/Embedded Device using C
MIT License
804 stars 108 forks source link

Is usrsctp required to open the data channel for string #54

Closed ladyhoai closed 7 months ago

ladyhoai commented 7 months ago

I'm trying to compile your library using the esp-idf framework. I'm using Ubuntu 22.04. I want to ask whether we need the usrsctp external library to send string to the other peer? I noticed that you have implemented your own stcp in case we don't have usrsctp, but I'm not sure how your sctp version works? I tried sending a string but it gives the error : "sctp not connected". I also noticed that the "connected" state is switched to true in the "sctp_incoming_data" function, but if sctp is not conencted, how can we receive data to turn "connected" to true? Love to hear your advice!

sepfy commented 7 months ago

Hello, sorry for late reply. if you are using the esp32, the project won't include usrsctp, because it's difficult to port usrsctp to esp32. i didn't follow any version to implement SCTP, i just made it work with Chrome. You must send datachannel message after the datachannel connected event callback. if the data from remote peer belongs DTLS message, the data will be classified as SCTP and call sctp_incoming_data to process. In this stage, the connection has not been established yet. After handshaking, the connected flag will be set true