setHttpExtraHeaders method

void setHttpExtraHeaders(
  1. Map<String, String>? newVal
)

Setter method that enables/disables the setting of extra HTTP headers to all the request performed to the Lightstreamer server by the client.

Note that the Content-Type header is reserved by the client library itself, while other headers might be refused by the environment and others might cause the connection to the server to fail.
For instance, you cannot use this method to specify custom cookies to be sent to Lightstreamer Server; leverage LightstreamerClient.addCookies instead. The use of custom headers might also cause the client to send an OPTIONS request to the server before opening the actual connection.

Default null (meaning no extra headers are sent).

Lifecycle This setting should be performed before calling the LightstreamerClient.connect method. However, the value can be changed at any time: the supplied value will be used for the next HTTP request or WebSocket establishment.

Notification A change to this setting will be notified through a call to ClientListener.onPropertyChange with argument "httpExtraHeaders" on any ClientListener listening to the related LightstreamerClient.

  • newVal a Map object containing header-name header-value pairs. Null can be specified to avoid extra headers to be sent.

Implementation

void setHttpExtraHeaders(Map<String, String>? newVal) {
  _httpExtraHeaders = newVal;
}