1

In a project that I'm currently working on I have an API call that's being sent via socketIO as follows:

Socket config:

const socket = io(URL, { path: PATH })

API call:

socket.emit(
  ProcessValues,
  {
    user_id: userID,
    file_id: fileID,
    socket_id: socketID
  }

By default, socketIO sends this as a GET request. However, the back end that this code interacts with is expecting this message as a POST request. Is it possible to specify this emit event as a POST request instead?

I'm familiar with using socketIO but didn't find much in the documentation on specifying HTTP methods in emit events.

  • That... doesn't really make sense. What do you mean the backend code expects a POST? It should be a websocket connection, HTTP is just the fallback. And it should be communicating with the socket server instance, not an arbitrary endpoint. – Jared Smith Nov 29 '22 at 19:17

0 Answers0