1.0.3 • Published 4 months ago

fusedeck-mobile-sdk-react-native v1.0.3

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
4 months ago

fusedeck-mobile-sdk-react-native

Getting started

Create an instance of the Fusedeck class.

import { Fusedeck, Event } from "fusedeck-mobile-sdk-react-native";

const propertyId = 'propXYZ123'; // public id of the property
const endpoint = 'wss://.....'; // Web socket endpoint to send events to

const fusedeck = new Fusedeck(propertyId, endpoint);

You need to specify the propertyId and a WebSocket endpoint. This information will be given to you by your fusedeck consultant.

It is advisable to only instanciate this object once in your application and make it globally available, i.e. by wrapping it into a service. However, if this is not possible you may also create multiple instances wherever they are needed.

Fusedeck will automatically open a WebSocket connection to the specified endpoint. If you have multiple instances of Fusedeck they will share a WebSocket connection if the property ID is the same.

Handling app lifecycle

Each open WebSocket connection uses server side resources even if it is idle. Therefore it is very important that fusedeck is considered in your app's lifecycle events. Fusedeck exposes methods, allowing you to pause and resume the connection. If your app is minimized and running the the background we recommend to pause tracking until the user is opening the app again.

AppState.addEventListener('change', nextAppState => {
  switch(nextAppState) {
    case 'active':
      fusedeck.resume();
      break;
    case 'background':
    case 'inactive':
      fusedeck.pause();
      break;
  }
});

Sending events

import { Fusedeck, Event } from "fusedeck-mobile-sdk-react-native";

const eventId = 12345678;

const event: Event = {
  eventId: eventId,
  values: {
    one: 123,
    two: 'test',
    three: {
      value: 'nested'
    }
  }
}

fusedeck.sendEvent(event);

Your fusedeck consultant will set up a universal event inside the property. The resulting eventId needs to be used to identify the event. The values field can be any (nested) object. The structure of values will be defined in the tracking concept and varies from case to case.

1.0.4-next.3

4 months ago

1.0.4-next.2

5 months ago

1.0.4-alpha.1

6 months ago

1.0.4-alpha.3

6 months ago

1.0.4-alpha.2

6 months ago

1.0.4-next.1

7 months ago

1.0.4-alpha.0

8 months ago

1.0.4-beta.0

8 months ago

1.0.4-beta.1

8 months ago

1.0.3-beta.0

10 months ago

1.0.3-beta.2

10 months ago

1.0.3-beta.1

10 months ago

1.0.4-next.0

10 months ago

1.0.3-beta.3

10 months ago

1.0.3-next.1

10 months ago

1.0.3

10 months ago

1.0.3-next.0

10 months ago

1.0.2

11 months ago

1.0.2-next.1

11 months ago

1.0.2-next.2

11 months ago

1.0.2-alpha.2

12 months ago

1.0.2-alpha.3

11 months ago

1.0.2-next.0

1 year ago

1.0.2-alpha.1

1 year ago

1.0.2-beta.0

1 year ago

1.0.2-alpha.0

1 year ago

1.0.1

1 year ago

1.0.1-alpha.0

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago

0.0.1-alpha.0

1 year ago