Function useSocket

  • A custom hook which allows using a websocket to connect to the server.

    Returns

    A function which can be used to send messages.

    Parameters

    • Optional onMessage: MessageHandler

      A function which gets invoked each time a message is received.

    • Optional onOpen: (() => void)

      A function which gets invoked when the socket is opened.

        • (): void
        • Returns void

    Returns SendMessage

Generated using TypeDoc