-
Notifications
You must be signed in to change notification settings - Fork 48
Contract
Fixed issue when image message's uid
haven't been transferred between devices but generated on each device without any relation.
6 - notifies that next data in the stream will be a file
-
flag
- ignored -
uid
- unique messge id -
body
- format{file_name}#{file_size}#{file_type}
-
file_name
- file name (must not contain#
) -
file_size
- file size (bytes) -
file_type
-1
for images (only images available right now)
-
Sample: 6#
1526373838213#0#nudes.png#46920#1
{type}#{uid}#{flag}#{body}
App checks all data transferred through the socket, if a piece of data starts with \d+#\d+#\d+#*
app will treat it as a message in other cases app will ignore data or treat it like a piece of file (depends on current state).
-1 - unexpected type, message won't be handled
0 - text message
-
flag
- ignored -
uid
- unique message id -
body
- message text
Sample: 0#1526373838213#0#Hi there
1 - report about message delivery
-
flag
-1
if a message has been delivered,0
if hasn't -
uid
- unique message id -
body
- ignored
Sample: 1#1526373838213#1#
2 - contains response to connection request
-
flag
-1
if connection has been accepted,0
- rejected -
uid
- ignored -
body
- format{name}#{color}#{contract_version}
-
name
- your partner's username (must not contain#
) -
color
- your partner's color -
contract_version
- version of contract in partner's app (to provide compatibility between different contracts in the future)
-
Sample: 2#0#1#Vasyl#-16742570#1
3 - connection request
-
flag
-1
if you want to connect to this device,0
- to notify partner that you are disconnecting -
uid
- ignored -
body
- format{name}#{color}#{contract_version}
(no need to send ifflag
is0
)-
name
- your username (must not contain#
) -
color
- your color -
contract_version
- version of contract in your app
-
Sample: 3#0#1#John#-30890#1
4 - contains info that partner has seen a message
-
flag
-1
if message has been seen by partner -
uid
- unique message id -
body
- ignored
Sample: 4#1526373838213#1#
5 - contains info that partner has edited a message
-
flag
-1
if a message has been edited by partner -
uid
- unique message id -
body
- edited message
Sample: 5#1526373838213#1#Edited message
6 - notifies that next data in the stream will be a file
-
flag
- ignored -
uid
- ignored -
body
- format{file_name}#{file_size}#{file_type}
-
file_name
- file name (must not contain#
) -
file_size
- file size (bytes) -
file_type
-1
for images (only images available right now)
-
Sample: 6#0#0#nudes.png#46920#1
7 - notifies that file was transfered completely
-
flag
- ignored -
uid
- ignored -
body
- ignored
Sample: 7#0#0#
8 - notifies that file transfer was canceled
-
flag
-1
if partner canceled transfer -
uid
- ignored -
body
- ignored
Sample: 8#0#1#