我在我的一个项目中使用RTCmulticonnection一切正常,除非它不能在不同的网络上工作。我已经经历了Github 问题,该问题表明它需要转向服务器才能在不同的网络上运行它。但我已经根据文档配置了转向服务器。
这是我的代码
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>
<script>
var connection = new RTCMultiConnection();
// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';
// if you want audio+video conferencing
connection.session = {
audio: true,
video: true
};
// first step, ignore default STUN+TURN servers
connection.iceServers = [];
// second step, set STUN url
connection.iceServers.push({
urls: 'stun:mydimain.com:3478'
});
// last step, set TURN url (recommended)
connection.iceServers.push({
urls: 'turn:mydimain.com:3478',
credential: 'mypassword',
username: 'myusername'
}); …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 larvel-9.0 项目上设置 websockets。当我尝试打开 /laravel-websockets 时,我在控制台中收到以下错误。项目在 Ubuntu 20.04.4 上安装。
Pusher.min.js:8 与 'wss://dev.mydomain.in:6001/app/mywebsocketkey?protocol=7&client=js&version=4.3.1&flash=false' 的 WebSocket 连接失败:
当我尝试通过带有 url 的邮递员连接它时,我收到成功响应
wss://dev.mydomain.in:6001/app/mywebsocketkey?protocol=7&client=js&version=4.3.1&flash=false
我在邮递员中收到以下回复。
{
"event": "pusher:connection_established",
"data": "{\"socket_id\":\"371175048.259495464\",\"activity_timeout\":30}"
}
Run Code Online (Sandbox Code Playgroud)
我遵循了Websockets 文档。
这是broadcast.php配置
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
'encrypted' => true,
'host' => 'dev.mydomain.in',
'port' => 6001,
'scheme' => 'https',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
]
], …Run Code Online (Sandbox Code Playgroud) 我已经安装了 TURN 服务器,服务器代码中的一切工作正常。日志文件中没有错误。只是一个警告说明
0: WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one IP address is provided
Run Code Online (Sandbox Code Playgroud)
但是TURN服务器运行在服务器上。
这是我检查时显示的内容 lsof -i :3478
turnserve 999 root 15u IPv4 446811411 0t0 TCP domain.com:stun (LISTEN)
turnserve 999 root 23u IPv4 446811417 0t0 TCP domain:stun (LISTEN)
turnserve 999 root 24u IPv4 446810998 0t0 UDP domain.com:stun
turnserve 999 root 25u IPv4 446810999 0t0 UDP domain.com:stun
Run Code Online (Sandbox Code Playgroud)
当我在Trickle ICE 中检查 STUN 时,它会引发错误
The server stun:xxx.xxx.xxx.xxx:3478 returned an error with code=701:
STUN server address is …Run Code Online (Sandbox Code Playgroud)