File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
api/AltV.Net.NetworkingEntity/Client Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,21 @@ import "./deps/reconnecting-websocket.min.js";
44class NetworkingEntity {
55 constructor ( ) {
66 alt . on ( "entitySetup" , ( url , token ) => {
7- this . websocket = new WebSocket ( url , token ) ;
7+ const protocolSplit = url . split ( "//" ) ;
8+ const protocol = protocolSplit [ 0 ] + "//" ;
9+ const splitUrl = protocolSplit [ 1 ] . split ( ":" ) ;
10+ if ( splitUrl . length > 2 ) {
11+ let address = "" ;
12+ for ( let i = 0 ; i < splitUrl . length - 1 ; i ++ ) {
13+ address += splitUrl [ i ] ;
14+ if ( i < splitUrl . length - 2 ) {
15+ address += ":" ;
16+ }
17+ }
18+ this . websocket = new WebSocket ( protocol + "[" + address + "]:" + splitUrl [ splitUrl . length - 1 ] , token ) ;
19+ } else {
20+ this . websocket = new WebSocket ( url , token ) ;
21+ }
822 } ) ;
923
1024 alt . on ( "entityDestroy" , ( ) => {
You can’t perform that action at this time.
0 commit comments