new eFTLConnection()
A connection object represents a program's connection to an eFTL server.
The eFTL JavaScript library creates new instances of eFTLConnection internally.
Programs use connection objects to send messages, and subscribe to messages.
Programs receive connection objects through onConnect, onError, onDisconnect, and onReconnect callbacks.
- See:
Methods
- 
    acknowledge(message)
- 
    
    
    Acknowledge this message. Messages consumed from subscriptions with a client acknowledgment mode must be explicitly acknowledged. The eFTL server will stop delivering messages to the client once the server's configured maximum number of unacknowledged messages is reached. Parameters:Name Type Description messageobject The message being acknowledged. 
- 
    acknowledgeAll(message)
- 
    
    
    Acknowledge all messages up to and including this message. Messages consumed from subscriptions with a client acknowledgment mode must be explicitly acknowledged. The eFTL server will stop delivering messages to the client once the server's configured maximum number of unacknowledged messages is reached. Parameters:Name Type Description messageobject The message being acknowledged. 
- 
    closeAllSubscriptions()
- 
    
    
    Close all subscriptions. For durable subscriptions, this call will cause the persistence service to stop delivering messages while leaving the durable subscriptions to continue accumulating messages. Any unacknowledged messages will be made available for redelivery. 
- 
    closeSubscription(subscriptionId)
- 
    
    
    Close a subscription. For durable subscriptions, this call will cause the persistence service to stop delivering messages while leaving the durable subscription to continue accumulating messages. Any unacknowledged messages will be made available for redelivery. Programs receive subscription identifiers via their onSubscribe handlers. Parameters:Name Type Description subscriptionIdobject Close this subscription. 
- 
    createKVMap(name) → {eFTLKVMap}
- 
    
    
    Create an eFTLKVMap.Parameters:Name Type Description namestring The key-value map name. Returns:A new key-value map.- Type
- eFTLKVMap
 
- 
    createMessage() → {eFTLMessage}
- 
    
    
    Create an eFTLMessage.Returns:A new message.- Type
- eFTLMessage
 
- 
    disconnect()
- 
    
    
    Disconnect from the eFTL server. Programs may disconnect to free server resources. This call returns immediately; disconnecting continues asynchronously. When the connection has closed, the eFTL library calls your onDisconnect callback. - See:
 
- 
    getClientId() → {string}
- 
    
    
    Gets the client identifier for this connection. - See:
 Returns:The unique client identifier.- Type
- string
 
- 
    isConnected() → {boolean}
- 
    
    
    Determine whether this connection to the eFTL server is open or closed.Returns:true if this connection is open; false otherwise.- Type
- boolean
 
- 
    publish(message, options)
- 
    
    
    Publish a one-to-many message to all subscribing clients. This call returns immediately; publishing continues asynchronously. When the publish completes successfully, the eFTL library calls your onComplete callback. When communicating with EMS, to publish a messages on a specific EMS destination include the message field name _dest. To distinguish between topics and queues the destination can be prefixed with either "TOPIC:" or "QUEUE:", for example "TOPIC:MyDest" or "QUEUE:MyDest". A destination with no prefix is a topic.Parameters:Name Type Description messageeFTLMessage Publish this message. optionsobject A JavaScript object holding publish callbacks. PropertiesName Type Argument Description onCompleteonComplete <optional> 
 Process publish completion. onErroronError <optional> 
 Process publish errors. ExampleTo publish a message on a specific EMS destination add a string field to the message; for example: message.set("_dest", "MyDest");
- 
    reconnect()
- 
    
    
    Reopen a closed connection. You may call this method within your onDisconnect callback. This call returns immediately; connecting continues asynchronously. When the connection is ready to use, the eFTL library calls your onReconnect callback. Reconnecting automatically re-activates all subscriptions on the connection. The eFTL library invokes your onSubscribe callback for each successful resubscription. 
- 
    removeKVMap(name)
- 
    
    
    Remove a key-value map. Parameters:Name Type Description namestring The key-value map name. 
- 
    sendReply(reply, request, options)
- 
    
    
    Send a reply message in response to a request message. This call returns immediately. When the send completes successfully, the eFTL library calls your onComplete callback. Parameters:Name Type Description replyeFTLMessage The reply message to send. requesteFTLMessage The request message. optionsobject A JavaScript object holding request callbacks. PropertiesName Type Argument Description onCompleteonComplete <optional> 
 Process reply completion. onErroronError <optional> 
 Process request errors. 
- 
    sendRequest(request, timeout, options)
- 
    
    
    Publish a request message. This call returns immediately. When the reply is received the eFTL library calls your onReply callback. Parameters:Name Type Description requesteFTLMessage The request message to publish. timeoutnumber The number of milliseconds to wait for a reply. optionsobject A JavaScript object holding request callbacks. PropertiesName Type Argument Description onReplyonReply <optional> 
 Process reply. onErroronError <optional> 
 Process request errors. 
- 
    startSubscription(subscriptionId)
- 
    
    
    Resume message delivery to a subscription. Parameters:Name Type Description subscriptionIdobject Start this subscription. 
- 
    stopSubscription(subscriptionId)
- 
    
    
    Stop message delivery to a subscription. Parameters:Name Type Description subscriptionIdobject Stop this subscription. 
- 
    subscribe(options) → {object}
- 
    
    
    Subscribe to messages. Register a subscription for one-to-many messages. This call returns immediately; subscribing continues asynchronously. When the subscription is ready to receive messages, the eFTL library calls your onSubscribe callback. A matcher can narrow subscription interest in the inbound message stream. An acknowledgment mode for the subscription can be set to automatically acknowledge consumed messages, require explicit client acknowledgment of the consumed messages, or to disable message acknowledgment altogether. The default is to automatically acknowledge consumed messages. When explicit client acknowledgment is specified the eFTL server will stop delivering messages to the client once the server's configured maximum number of unacknowledged messages is reached. When communicating with EMS, to subscribe to messages published on a specific EMS destination use a subscription matcher that includes the message field name _dest. To distinguish between topics and queues the destination name can be prefixed with either "TOPIC:" or "QUEUE:", for example "TOPIC:MyDest" or "QUEUE:MyDest". A destination name with no prefix is a topic.Parameters:Name Type Description optionsobject A JavaScript object holding subscription callbacks. PropertiesName Type Argument Description matcherstring <optional> 
 The subscription uses this content matcher to narrow the message stream. durablestring <optional> 
 The subscription is associated with this durable name. ackstring <optional> 
 An optional message acknowledgment mode; 'auto', 'client', or 'none'. Default is 'auto'. typestring <optional> 
 An optional durable type; 'shared' or 'last-value'. keystring <optional> 
 The key field for 'last-value' durable subscriptions. onSubscribeonSubscribe <optional> 
 The new subscription is ready. onErroronError <optional> 
 Process subscription errors. onMessageonMessage <optional> 
 Process inbound messages - See:
 Returns:The subscription identifier.- Type
- object
 ExampleTo subscribe to messages published on a specific EMS destination, create a subscription matcher for that destination; for example: var matcher = '{"_dest":"MyDest"}';
- 
    unsubscribe(subscriptionId)
- 
    
    
    Unsubscribe from messages on a subscription. For durable subscriptions, this call will cause the persistence service to remove the durable subscription, along with any persisted messages. Programs receive subscription identifiers via their onSubscribe handlers. Parameters:Name Type Description subscriptionIdobject Close this subscription. 
- 
    unsubscribeAll()
- 
    
    
    Unsubscribe from messages on all subscriptions. For durable subscriptions, this call will cause the persistence service to remove the durable subscription, along with any persisted messages.