import * as utils from 'medifi-common-utils'
import { Signal } from 'medifi-common-utils'
Signal.types // Object containing our signal types
Signal.parseSignal // Parses a signal regardless of type
Signal.serializers.connection(user, dateSent, ready)
Signal.serializers.message(user, dateSent, messageString)
Signal.serializers.typing(user, dateSent, isTyping)
Signal.serializers.endSession(user, dateSent)
// for video
Signal.serializers.requestVideoCall(user, dateSent)
Signal.serializers.cancelVideoCallRequest(user, dateSent)
Signal.serializers.acceptVideoInvite(user, dateSent)
Signal.serializers.rejectVideoInvite(user, dateSent)
Signal.serializers.endVideoCall(user, dateSent)
// ... etc
let serializer = Signal.serializers.getSerializer(Signal.types.MESSAGE)
serializer(user, dateSent, messageString) // is equal to Signal.serializers.message
NOTE: The user object should be a user with an id
, fullName
and role
property
NOTE: The message object should be a a message with an id
and body
property
shape:
{
user: {
id: '1',
fullName: 'Sieg Collado',
role: 'Doctor'
},
dateSent: 1231231313,
message: 'Hello!'
}
{
user: {
id: '1',
fullName: 'Sieg Collado',
role: 'Doctor'
},
dateSent: 1232132131,
isTyping: true // or false
}
- complete readme
- move reusable methods here