Skip to content

Instantly share code, notes, and snippets.

@danbev
Last active December 21, 2015 10:49
Show Gist options
  • Save danbev/6294945 to your computer and use it in GitHub Desktop.
Save danbev/6294945 to your computer and use it in GitHub Desktop.
SimplePush Subsystem Configuration

SimplePush Server Subsystem Configuration

This is a suggestion for the configuration of the SimplePush WildFly subsystem (AGPUSH-242). Note that this includes all configurable options and we will provide resonable defaults so that all are not required.

<subsystem xmlns="urn:org.jboss.aerogear.simplepush:1.0">
    <server 
        socket-binding="simplepush-socket-binding" 
        datasource-jndi-name="java:jboss/datasources/SimplePushDS" 
        token-key="936agbbhh6ee99=999333" 
        useragent-reaper-timeout="604800000"
        notification-prefix="update"
        notification-tls="true"
        notification-ack-interval="60000"
        notification-socket-binding="simplepush-notify"
        sockjs-prefix="simplepush"
        sockjs-cookies-needed="true"
        sockjs-url="http://cdn.sockjs.org/sockjs-0.3.4.min.js"
        sockjs-session-timeout="5000"
        sockjs-heartbeat-interval="25000"
        sockjs-max-streaming-bytes-size="131072"
        sockjs-tls="false"
        sockjs-keystore="/simplepush.keystore"
        sockjs-keystore-password="password"
        sockjs-websocket-enabled="true" 
        sockjs-heartbeat-interval="18000" 
        sockjs-protocols="push-notification"
    </server>
</subsystem>

socket-binding

This is the name of a socket-binding configured in the socket-binding-group section in a WildFly configuration xml file.

datasource-jndi-name

This referes to a JNDI name of a datasource that configured and bound. The datasource would normally be configured in the same WildFly configuration xml file.

token-key

This should be a random token which will be used by the server for encryption/decryption of the endpoint URLs that are returned to clients upon successful channel registration.

useragent-reaper-timeout

This is the amount of time which a UserAgent can be inactive after which it will be removed from the system.

notification-prefix

The prefix for the the notification endpoint url. This prefix will be included in the endpointUrl returned to the client to enabling them to send notifications.

notification-tls

Configures Transport Layer Security (TLS) for the notification endpointUrl that is returned when a UserAgent/client registers a channel. Setting this to true will return a url with https as the protocol.

notification-ack-interval

This is the interval time for resending un-acknowledged notifications.

notification-socket-binding

This is the name of a socket-binding configured in the socket-binding-group section in a WildFly configuration xml file. This information to configure the host and port that will be returned as the notification endpoints that backend servers can use to send notifications to a channel. The configuration for this socket-binding could look like this:

<interfaces>
    <interface name="external">
        <inet-address value="domain1.com"/>
    </interface>
</interfaces>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="simplepush" port="7777"/>
    <socket-binding name="simplepush-notification" interface="external" port="7777"/>
</socket-binding-group>

SockJS configuration options

AeroGear SimplePush Server uses the SockJS protocol to enable fallback handling for environments where WebSocket support my be limited. This can be cause with older browsers or where restrictive proxies are in play.

sockjs-prefix

The prefix/name, of the SockJS service. For example, in the url "http://localhost/simplepush/111/12345/xhr", 'simplepush' is the prefix.

sockjs-cookies-needed

This is used by some load balancers to enable session stickyness.

sockjs-url

The url to the sock-js-.json. This is used by the 'iframe' protocol and the url is replaced in the script returned to the client. This allows for configuring the version of sockjs used. By default it is 'http://cdn.sockjs.org/sockjs-0.3.4.min.js'.

sockjs-session-timeout

A timeout for inactive sessions.

sockjs-heartbeat-interval

Specifies a heartbeat interval.

sockjs-max-streaming-bytes-size

The max number of types that a streaming transport protocol should allow to be returned before closing the connection, forcing the client to reconnect. This is done so that the responseText in the XHR Object will not grow and be come an issue for the client. Instead, by forcing a reconnect the client will create a new XHR object and this can be see as a form of garbage collection.

sockjs-tls

Specified whether Transport Layer Security (TLS) should be used by the SockJS layer.

sockjs-keystore

If tls is in use then the value of this property should be a path to keystore available on the classpath of the subystem.

sockjs-keystore-password

If tls is in use, then the value of this property should be the password to the keystore specified in keystore.

sockjs-websocket-enabled

Determines whether WebSocket support is enabled on the server.

sockjs-websocket-heartbeat-interval

A heartbeat-interval for WebSockets. This interval is separate from the normal SockJS heartbeat-interval and might be required in certain environments where idle connection are closed by a proxy. It is a separate value from the hearbeat that the streaming protocols use as it is often desirable to have a much larger value for it.

sockjs-websocket-protocols

Adds the given protocols which will be returned to during the Http upgrade request as the header 'WebSocket-Protocol'. This is only used with raw WebSockets ad the SockJS protocol does not support protocols to be specified by the client yet.

@ctomc
Copy link

ctomc commented Aug 26, 2013

for external-host / external-port you could use outbound-socket-binding functionality, which is essentially same thing as socket-binding but for outgoing connections.

@danbev
Copy link
Author

danbev commented Aug 29, 2013

@ctomc Oh, I did not know that. Thanks for point that out!

@danbev
Copy link
Author

danbev commented Sep 11, 2013

@ctomc I've been looking at the outbound-socket-binding functionality and from what I understand this is used when the server act like a client. In this specific case the external-host/external-port are the host/port that the server accepts http notification request on. So perhaps outbound-socket-binding is not appropriate here, but instead we should use an additional outbound-socket-binding for this. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment