1

In my app.js I have

io.sockets.on("connection", connectSocket);

and then in a different file I have:

const connectSocket = (socket, bitlyAppURL) => {
  socket.once(AUTHENTICATED_CONNECTION_REQUEST, params => {
    connectAuthenticatedSocket(socket, params, bitlyAppURL);
  });

  socket.once("disconnect", disconnectSocket);

  socket.emit(AUTHENTICATE_YOURSELF);
};

but I'm not sure how to pass this bitlyAppURL into the function in app.js.

1 Answer 1

4

use the callback of socket.on :

io.sockets.on("connection", socket => connectSocket(socket, bitlyAppURL));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.