replaceMasterDevice

@MessageMapping(value = ["replace.master"])
suspend fun replaceMasterDevice(@Payload device: ByteArray, @DestinationVariable client: String): RSocketResponse

Replace master device request/response RSocket API. Takes as argument a ReplaceMasterDeviceRequest encoded in ProtoBuf format in payload. In metadata takes the client path as String.

Replaces the old master-device by deleting it and makes the receiving device the new master-device. Also, through this API the end-user's new device discovers its account's uuid. After this operation the device should set its signal-keys.

Returns a HubPayload encoded in ProtoBuf format. In case the operation was successful the HubPayload contains data with account's info. Else it contains error with the corresponding code. If there is not a matching registered account with the same msisdn it returns code 404. If the registrationId is the same with the current master device then it returns code '409', but the operation may be retried with new registrationId. In case the format of ReplaceMasterDeviceRequest was not as expected it returns code 400.

Experimental API

This API is still under development, which means that the design of the declaration may (or may not) change in the future in some way that may break the code. See issue #327 to track the implementation.