Skip to content

emitWithAck does not throw on disconnect #4964

@jd1378

Description

@jd1378

Describe the bug
Take the following steps:

  • put browser into offline mode
  • use emitWithAck to send a message immediately
  • expect emitWithAck to throw on disconnect, but it does not
  • put browser into online mode and reconnect.
  • emitWithAck still not resolving.

To Reproduce

Socket.IO client and server version: 4.7.4

I used the socket.io chat example to make a reproduction repo:
https://github.com/jd1378/socketio-emit-ack-bug

Expected behavior

I expect the emitWithAck to throw once the socket is disconnected. OR, I expect emitWithAck to retry the request, as it's not volatile.

Platform:

  • Windows 10, Edge browser

Additional context

What's even better than the expected behavior? a new option to control the behavior.

what I really want is to be able to detect the failure of my requests and throw, much like how a fetch request would throw if connection fails. and I don't want to retry the request automatically when it's thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions