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.

Allow socket to be provided from outside

See original GitHub issue

I’ve got all my front end code nicely managed by JSPM and I would like to avoid having to put the socket.io client on my pages window object.

Maybe one of the constructor overloads for new Echo could look like this:

const socket = io("http://localhost:8083");

const echo = new Echo({
    broadcaster: "socket.io",
    socket: socket,
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
driesvintscommented, Oct 31, 2018

Actually, I just noticed this is already possible. You can define the client on a client key in the options object: https://github.com/laravel/echo/blob/c829764fe05028462b4dc88fb5d7dd82b3b1914c/src/connector/socketio-connector.ts#L45-L47

I’ll try to update the docs with this.

1reaction
atrauzzicommented, Oct 31, 2018

Well look at that! I opened this ticket quite some while ago, so I guess that just managed to sneak in on common sense. 😉

Thanks for finding this ticket so I could get the update!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using sockets outside their dedicated 'connection' scope
Answering your question: if you want to use sockets outside of their respective "io.sockets.on('connection', function(socket){} scope", you have to access ...
Read more >
Socket Basics - Programming Interfaces Guide
The accept(3SOCKET) routine normally blocks processes. accept(3SOCKET) returns a new socket descriptor that is connected to the requesting client. The value of ...
Read more >
How sockets work - IBM
When an application has a socket descriptor, it can bind a unique name to the socket. Servers must bind a name to be...
Read more >
Programming with TCP/IP sockets - Rutgers CS
A socket is the mechanism that most popular operating systems provide to give programs access to the network. It allows messages to be...
Read more >
Socket Programming HOWTO — Python 3.11.1 documentation
On any given platform, there are likely to be other forms of IPC that are faster, ... while True: # accept connections from...
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