status-go/services/shhext
Dmitry Shulyak f2c6fef64c
Persist selected mail server using separate monitor (#1303)
This change allows to connect to the mail server that we were using before the app was restarted. Separate loop is listening for whisper events, and when we receive event that request was completed we will update time on a peer record.

Records are stored in leveldb. Body of the record is marshaled using json. At this point the only field is a timestamp when record was used.

This loop doesn't control connections, it only tracks what mail server we ended up using. It works asynchronously to connection management loop. Which tracks events that are related to connection state and expiry of the requests.

When app starts we look into the database and select the most recently used record. This record is added to connection management loop first. So if this server is available we will stick to using it. If we weren't able to connect to the same server in configured timeout (5s) we will try to connect to any other server from list of active servers.

closes: #1285
2018-12-12 11:39:00 +02:00
..
chat Hash password before using it (#1306) 2018-12-10 14:11:19 +01:00
dedup Use status-im whisper/whisperv6 module everywhere 2018-10-03 09:27:51 +03:00
mailservers Persist selected mail server using separate monitor (#1303) 2018-12-12 11:39:00 +02:00
README.md Implement mailserver canary service. Closes #1086 2018-08-07 17:17:59 +02:00
api.go Fix cursor encoding (#1308) 2018-12-11 11:23:47 +01:00
api_test.go Fix cursor encoding (#1308) 2018-12-11 11:23:47 +01:00
debug.go Use status-im whisper/whisperv6 module everywhere 2018-10-03 09:27:51 +03:00
service.go Persist selected mail server using separate monitor (#1303) 2018-12-12 11:39:00 +02:00
service_test.go Persist selected mail server using separate monitor (#1303) 2018-12-12 11:39:00 +02:00
signal.go Mailserver: return error response. (#1244) 2018-10-18 12:25:00 +02:00
tracker.go Ensure sent event is received from a mailserver (#1304) 2018-12-06 10:30:57 +01:00
tracker_test.go Persist selected mail server using separate monitor (#1303) 2018-12-12 11:39:00 +02:00

README.md

Whisper API Extension

API

shhext_getNewFilterMessages

Accepts the same input as shh_getFilterMessages.

Returns

Returns a list of whisper messages matching the specified filter. Filters out the messages already confirmed received by shhext_confirmMessagesProcessed

Deduplication is made using the whisper envelope content and topic only, so the same content received in different whisper envelopes will be deduplicated.

shhext_confirmMessagesProcessed

Confirms whisper messages received and processed on the client side. These messages won't appear anymore when shhext_getNewFilterMessages is called.

Parameters

Gets a list of whisper envelopes.

shhext_post

Accepts same input as shh_post.

Returns

DATA, 32 Bytes - the envelope hash

shhext_requestMessages

Sends a request for historic messages to a mail server.

Parameters
  1. Object - The message request object:
  • mailServerPeer:URL - Mail servers' enode addess
  • from:QUANTITY - (optional) Lower bound of time range as unix timestamp, default is 24 hours back from now
  • to:QUANTITY- (optional) Upper bound of time range as unix timestamp, default is now
  • topic:DATA, 4 Bytes - Regular whisper topic
  • symKeyID:DATA- ID of a symmetric key to authenticate to mail server, derived from mail server password
Returns

Boolean - returns true if the request was send, otherwise false.

Signals

Sends sent signal once per envelope.

{
  "type": "envelope.sent",
  "event": {
    "hash": "0xea0b93079ed32588628f1cabbbb5ed9e4d50b7571064c2962c3853972db67790"
  }
}

Sends expired signal if envelope dropped from whisper local queue before it was sent to any peer on the network.

{
  "type": "envelope.expired",
  "event": {
    "hash": "0x754f4c12dccb14886f791abfeb77ffb86330d03d5a4ba6f37a8c21281988b69e"
  }
}