question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using multiple sockets

See original GitHub issue

Trying to use two sockets as per instructions gives me errors. I have added socket in providers array in page module. providers: [Socket]

In app.module: import { Socket } from ‘ngx-socket-io’; and the two export class SocketOne extends Socket { …

providers: [ SocketOne, SocketTwo,

This is in an Ionic 4 /Angular 7 app.

This is my error: ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[WrappedSocket -> InjectionToken SOCKET_IO_CONFIG]: StaticInjectorError(Platform: core)[WrappedSocket -> InjectionToken SOCKET_IO_CONFIG]: NullInjectorError: No provider for InjectionToken SOCKET_IO_CONFIG!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
thiercecommented, Mar 8, 2019

I went this route:

I have two services, each accessing a socket, or in my case, different Namespaces of the same socket. In each service, I use the following:

@Injectable({providedIn: 'root'})
export class Socket1 extends Socket {
  constructor() {
    super({url: 'https://somefunkydomain:3001/thenamespace', options: {}});
  }
}

“thenamespace” is all that is changed between the two services. In the service constructor: public socket: Socket1,

Now I just access each socket, from each service as I need them.

0reactions
ctfranciacommented, Apr 28, 2020

This issue is over a year old now, if the issue hasn’t been resolved then please feel free to open up a new ticket, just so we can track new issues and get rid of the clutter

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can a process have multiple sockets? - Quora
The short answer is yes. The longer answer is still yes, but you need to handle them properly. I'm going to assume you're...
Read more >
Using multiple nodes | Socket.IO
When deploying multiple Socket.IO servers, there are two things to take care of: enabling sticky session, if HTTP long-polling is enabled (which ...
Read more >
Socket Programming in C/C++: Handling multiple clients on ...
A better way to handle multiple clients is by using select() linux ... //Handle multiple socket connections with select and fd_set on Linux....
Read more >
Handle multiple socket connections with fd_set and select on ...
In this tutorial we shall use the select method approach. The select function allows the program to monitor multiple sockets for a certain...
Read more >
Receiving data from multiple sockets at once (Multithreading)
When a remote client connects to it, a communication channel (i.e. socket) is created. If another client connects, another socket is created.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found