NathanaelA / nativescript-websockets

Websockets for NativeScript
83 stars 43 forks source link

advace interface doesn't work on android #62

Closed i-jw closed 3 years ago

i-jw commented 5 years ago

i use nativescript-websocket 1.5.0 only Browser based Interface can open when I use Advanced Interface to create Websocket like this : this.mySocket = new WebSocket(url, {timeout: 6000}); this.mySocket.open(); the error log as below app/pages/items.component.ts(142,21): error TS2551: Property 'open' does not exist on type 'WebSocket'. Did you mean 'OPEN'? app/pages/items.component.ts(655,41): error TS2345: Argument of type '{ timeout: number; }' is not assignable to parameter of type 'string | string[]'. Object literal may only specify known properties, and 'timeout' does not exist in type 'string | string[]'. which version support the advace interface

NathanaelA commented 3 years ago

Yeah, that doesn't work. You have to do: const WS = require('@master.technology/websockets'); then use WS to create a new websocket. If you attempt to use the default un-scoped/global "WebSocket" this is the browser version