Skip to content

Latest commit

 

History

History
196 lines (101 loc) · 5.73 KB

API.md

File metadata and controls

196 lines (101 loc) · 5.73 KB

SockJsClient

src/client.jsx:15-279

Extends React.Component

Methods

connect

src/client.jsx:232-237

Connect to the server if not connected. Under normal circumstances component will automatically try to connect to server. This method is mostly useful after component is explicitly disconnected via SockJsClient#disconnect.

disconnect

src/client.jsx:244-262

Disconnect STOMP client and disable all reconnect.

sendMessage

src/client.jsx:272-279

Send message to the specified topic.

Parameters

  • topic string target topic to send message
  • msg string message to send
  • opt_headers Object additional headers for underlying STOMP client (optional, default {})

Props

url

src/client.jsx:32-32

HTTP URL of the endpoint to connect.

options

src/client.jsx:38-38

Additional options to pass to the underlying SockJS constructor.

topics

src/client.jsx:42-42

Array of topics to subscribe to.

onConnect

src/client.jsx:46-46

Callback after connection is established.

onDisconnect

src/client.jsx:50-50

Callback after connection is lost.

getRetryInterval

src/client.jsx:56-56

Gets called to find the time interval for next retry. Defaults to a function returing retryCount seconds.

Parameters

  • retryCount number number of retries for the current disconnect

onMessage

src/client.jsx:63-63

Callback when a message is recieved.

Parameters

  • msg (string | Object) message received from server, if JSON format then object
  • topic string the topic on which the message was received

headers

src/client.jsx:67-67

Headers that will be passed to the server or broker with STOMP's connection frame.

subscribeHeaders

src/client.jsx:71-71

Headers that will be passed when subscribing to a destination.

autoReconnect

src/client.jsx:75-75

Should the client try to automatically connect in an event of disconnection.

debug

src/client.jsx:79-79

Enable debugging mode.

heartbeat

src/client.jsx:83-83

Number of milliseconds to send and expect heartbeat messages.

heartbeatIncoming

src/client.jsx:87-87

Number of milliseconds to expect heartbeat messages

heartbeatOutgoing

src/client.jsx:91-91

Number of milliseconds to send heartbeat messages

onConnectFailure

src/client.jsx:95-95

Callback when connection could not be established

Parameters

  • error (Object) error throwed by the SockJs Client