Skip to content

Different behaviors between disconnect() and forceDisconnect()? #853

@AF-cgi

Description

@AF-cgi

Hi,
I use the WSEngine with both methods: disconnect() and forceDisconnect(). Now I figured out, that the handling of this methods are different. From my perspective there is one missing call in the forceDisconnect() method.

In WSEngine.stop() which is called via disconnect():

write(data: payload, opcode: .connectionClose, completion: { [weak self] in
    self?.reset()
    self?.forceStop()
})

In WSEngine forceStop() which is called via forceDisconnect():

public func forceStop() {
    transport.disconnect()
}

If we re-init or reconnect a socket, there will be called WSEngine.start(request:) method. In some cases by using WebSocket.forceDisconnect() the property canSend won't be reset to false. In that case the method start(request:) will be returned at the beginning and no connection will be created.
Has anybody the same issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions