File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -680,7 +680,11 @@ const response = await axios.get(\`https://your-panel.com/api/client/servers/\${
680680const { token, socket } = response.data.data;
681681
682682// Connect to WebSocket
683- const ws = new WebSocket(socket);
683+ const ws = new WebSocket(socket, {
684+ headers: {
685+ 'Origin': 'https://your-panel.com '
686+ }
687+ });
684688
685689ws.on('open', () => {
686690 // Authenticate
@@ -747,7 +751,11 @@ ws.run_forever()`
747751Use the returned token and socket URL to establish a WebSocket connection:
748752
749753``` javascript
750- const socket = new WebSocket (' wss://node.example.com:8080/api/servers/d3aac109-e5e0-4331-b03e-3454f7e136dc/ws' );
754+ const socket = new WebSocket (' wss://node.example.com:8080/api/servers/d3aac109-e5e0-4331-b03e-3454f7e136dc/ws' , {
755+ headers: {
756+ ' Origin' : ' https://your-panel.com'
757+ }
758+ });
751759
752760socket .addEventListener (' open' , function (event ) {
753761 // Authenticate with the WebSocket
You can’t perform that action at this time.
0 commit comments