API Docs for: 0.9.9
Show:

MXP Class

Defined in: src/MXP/MXP.js:8
Module: MXP

A class MXP Protocol (Message eXchange Protocol)

Constructor

MXP

(
  • sinch
)
protected

Defined in src/MXP/MXP.js:8

Parameters:

  • sinch SinchClient

    Create new MXP object for a particular user

Methods

close

() protected

Defined in src/MXP/MXP.js:73

Unsubscribe from MXP channels

Returns:

promise which resolves when all channels have been unsubscribed

collectFrames

() protected chainable async

Defined in src/MXP/MXP.js:285

Collect MXP Frames for a particular incoming message / set of messages.

Returns:

promise which resolves a new message consisting of all frames

configureMxpSession

(
  • sessionKey
  • key
  • body
)
protected async

Defined in src/MXP/MXP.js:235

Store data on a particular MXP session, used for call signalling

Parameters:

  • sessionKey String

    The session key for which to store session details

  • key String

    The session key used for encrypting signalling messages

  • body String

    Information attached with the session, such as proxy URL

constructMXP

(
  • msgObj
)
MXPMessageObj protected

Defined in src/MXP/MXP.js:624

Method to construct MXP Message by padding an incoming MXP Message with necessary parameters

Parameters:

Returns:

MXPMessageObj:

updated msgObj

destroy

() protected

Defined in src/MXP/MXP.js:90

Internal function to destroy MXP

Returns:

undefined

getTransport

(
  • msgObj
)
Object | MXPMessageObj protected chainable async

Defined in src/MXP/MXP.js:437

Method to retrieve transport by transportId or recipientId's, can be used in a chan with MXPMessageObj as input/output

Parameters:

  • msgObj MXPMessageObj | Object

    The object containing the recipientId's in some way, or the transport Id.

Returns:

Object | MXPMessageObj:

getTxChannels

(
  • msgObj
)
protected

Defined in src/MXP/MXP.js:716

Identify transmit channels for a particular MXPMessageObj

Parameters:

Returns:

msgObj

handleError

(
  • error
)
protected

Defined in src/MXP/MXP.js:422

Handle error messages by logging + writing to console if there's an error stack

Parameters:

  • error Error

    The error message or object

Returns:

undefined

handleMessage

(
  • msgObj
)
protected chainable async

Defined in src/MXP/MXP.js:389

Handle decrypted message and pass to the right set of handlers as specified by other parts of the MXP protocol. (i.e., MXPCalling or MXPMessaging)

Parameters:

Returns:

undefined

identifyEnKey

(
  • msgObj
)
protected

Defined in src/MXP/MXP.js:644

Method to identify encryption key. The options are; instance key, session key or transport key.

Parameters:

  • msgObj MXPMessageObj

    The object to identify suitable encryption key for.

Returns:

msgObj

identifyKey

(
  • assembledMessage
)
MXPMessageObj protected chainable async

Defined in src/MXP/MXP.js:335

Identify decryption key for a complete MXP message (headers + defragmented content + footers). Analyzes if message was encrypted using a transport key, signal key or instance key.

Parameters:

  • assembledMessage String

    A complete MXP message.

Returns:

MXPMessageObj:

promise which resolves into a new with all correct initial data.

init

() protected chainable async

Defined in src/MXP/MXP.js:60

Initializes MXP by setting up necessary PubNub subscriptions

Returns:

promise which resolves when all channels have been subscribed

processUnencryptedForKey

(
  • sessionKey
)
protected async

Defined in src/MXP/MXP.js:250

Handle previously un-encrypted messages for a particular session key

Parameters:

  • sessionKey String

    The session key for which to process unencrypted messages

sendMessage

(
  • message
)
protected chainable async

Send a message over MXP

Parameters:

Returns:

promise which resolves into the message object

sendMsgAck

(
  • msgObj
)
protected async

Send a new IM ack over MXP

Parameters:

  • msgObj MXPMessageObj

    The recieved message to acknowledge delivery of

Returns:

undefined

sendMXP

(
  • msgObj
)
protected chainable async

Defined in src/MXP/MXP.js:588

Send MXP Message as defined by the incoming msgObj {MXPMessageObj}

Parameters:

Returns:

promise which resolves into the updated message object

signalStatus

() protected

Defined in src/MXP/MXP.js:197

Check for subscription on Signal

Returns:

boolean, true for subscribed

splitFrames

(
  • msgObj
)
MXPMessageObj protected

Defined in src/MXP/MXP.js:670

Split a full MXP message into many frames. Resulting frames stored in the {MXPMessageObj}

Parameters:

Returns:

MXPMessageObj:

msgObj with frames

subscribe

(
  • channel
)
protected chainable async

Defined in src/MXP/MXP.js:176

Internal function to unsubscribe to channels for a pupnub object

Parameters:

  • channel String

    A channel, or list of channels.

Returns:

promise which resolves null when complete

subscribe

(
  • channel
)
protected chainable async

Defined in src/MXP/MXP.js:102

Internal function to subscribe to channels for a pupnub object

Parameters:

  • channel String

    A channel, or list of channels.

Returns:

promise which resolves null when complete

subscribe2

(
  • channel
)
protected chainable async

Defined in src/MXP/MXP.js:142

Internal function to subscribe to special PubNub channels

Parameters:

  • channel String

    A channel, or list of channels.

Returns:

promise which resolves null when complete

transmitFrames

(
  • msgObj
)
protected chainable async

Defined in src/MXP/MXP.js:738

Transmit MXP Frames stored in a {MXPMessageObj}

Parameters:

  • msgObj MXPMessageObj

    the full MXP object containing all info we need

Returns:

promise which resolves into msgObj

Attributes

MXPCallingVersion

Number

Describe the version number of messaging

MXPMessagingVersion

Number

Describe the version number of messaging

Events

_ondisconnectPubNub

protected

Defined in src/MXP/MXP.js:265

Handle disconnects from PubNub, log the event

Event Payload:

  • message String

    Reason for discionnect

_onmessagePubNub

protected

Defined in src/MXP/MXP.js:208

Incoming PubNub messages, any channel / origin. Initiatiates the MXP inbound message processing chain.

Event Payload:

  • message String

    The raw message recieved by PubNub