We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey guys,
I want to implement a client application where a user can provide a server url. So the socket url needs to be dynamically set.
At the moment I have to hardcode the url to app.module.ts:
app.module.ts
import { SocketIoModule, SocketIoConfig } from 'ng-socket-io'; const config: SocketIoConfig = { url: 'http://xxx.xxx.x.x:PORT' };
but I need something like this (serverUrl is an input in home.html. connectToServer() is called on a button click):
serverUrl
connectToServer()
export class HomePage { serverUrl: ''; constructor(public navCtrl: NavController, private socket: Socket) {} connectToServer() { this.socket.connect(this.serverUrl); if (this.socket.ioSocket.connected) { this.navCtrl.push('DeckPage'); } } }
Can you guys provide any help? Thanks in Advance!
Best regards Nick
The text was updated successfully, but these errors were encountered:
Hello,
I also need to make the URL configurable, have you found a solution for this situation?
Sorry, something went wrong.
@Injectable() export class Socket_Test extends Socket {
constructor() { super({ url: '<SOCKET_URL>', options: {"rememberUpgrade":true, "transports":["websocket","polling"], "secure":true,"rejectUnauthorized":true, "autoConnect":false, "query":"token=<TOKEN VALUE>" } }); } init(token){ this.ioSocket.query = {token:token}; }
}
call function this.socket.init(); this.socket.connect();
No branches or pull requests
Hey guys,
I want to implement a client application where a user can provide a server url.
So the socket url needs to be dynamically set.
At the moment I have to hardcode the url to
app.module.ts
:but I need something like this (
serverUrl
is an input in home.html.connectToServer()
is called on a button click):Can you guys provide any help?
Thanks in Advance!
Best regards
Nick
The text was updated successfully, but these errors were encountered: