Commit Graph

729 Commits

Author SHA1 Message Date
Evgeny Poberezkin 7249cb0f0e
close socket on connection exception (#365) 2022-04-29 13:12:30 +01:00
Evgeny Poberezkin f8ec838912
prevent servers from reconnecting when the agent is closed (#364)
* prevent servers reconnecting when the agent is closed

* fail creating NTF server connection when the agent is closed
2022-04-25 16:04:06 +01:00
Evgeny Poberezkin c6dde772b4
batch all connections in DOWN/UP agent messages (#363) 2022-04-25 08:26:52 +01:00
Evgeny Poberezkin 633cd675b5
ToJSON instance for NtfTknStatus (#362) 2022-04-22 20:02:02 +01:00
Evgeny Poberezkin 83c18272cf
Merge pull request #361 from simplex-chat/ep/ntf-token-status-2
registerNtfToken returns token status
2022-04-22 18:18:45 +01:00
Evgeny Poberezkin 7652ece045 registerNtfToken returns token status 2022-04-22 17:50:30 +01:00
Evgeny Poberezkin 7774fc3271 update swift flag 2022-04-21 18:14:41 +01:00
Evgeny Poberezkin 43d24d07dd
Merge pull request #334 from simplex-chat/notifications-server
push notifications server
2022-04-21 17:21:09 +01:00
Evgeny Poberezkin a2204c9b84 remove comments, add EOL 2022-04-21 17:15:41 +01:00
Evgeny Poberezkin f718a84335 change log level to error 2022-04-21 17:07:39 +01:00
Evgeny Poberezkin e6fbaf5e50
primary tokens (#356)
* primary tokens

* support repeat token registration (TODO fix tests)

* fix notifications tests

* fix/test repeat/new registrations of the same token

* re-register token when subsequent ntf command fails with AUTH error (e.g. when server is re-started)

* cancel periodic notifications when token is deleted on the server

* debug failing test on CI

* fix notification test in CI

* debug CI test

* add delay in notificaitons test after server restart
2022-04-21 17:04:26 +01:00
Evgeny Poberezkin 7541ef4c13
Merge pull request #359 from simplex-chat/master
merge master to stable
2022-04-21 15:22:45 +01:00
Evgeny Poberezkin 5eb2822d25 use cpp-options 2022-04-21 15:16:18 +01:00
Evgeny Poberezkin 0a2cad2745
version 1.1.0 (#358)
* version 1.1.0

* increase test delays to stabilize
2022-04-21 15:00:30 +01:00
Evgeny Poberezkin 4dc7d9bc77 Merge branch 'master' into notifications-server 2022-04-21 14:35:23 +01:00
JRoberts 12caa328a8
SMP confirmation timeout recovery rfc (#357) 2022-04-20 22:17:51 +01:00
Evgeny Poberezkin b5c5a8ad2a rename Subscriptions.hs/Store.hs 2022-04-20 11:54:37 +01:00
Evgeny Poberezkin 60d0f19121 Merge branch 'master' into notifications-server 2022-04-20 08:23:26 +01:00
Evgeny Poberezkin 68f52c47dd
message TTL and periodic expiration; setting to prevent creation of the new queues (#355)
* message TTL and periodic expiration; setting to prevent creation of the new queues

* fix expiration interval
2022-04-20 08:14:26 +01:00
Evgeny Poberezkin 6f3e9dc603 Merge branch 'master' into notifications-server 2022-04-18 09:08:53 +01:00
Evgeny Poberezkin 17888f89a9
test notification token with agent and notifications server (#353)
* test notification token with agent and notifications server

* notification server test with APNS mock

* set environment variables in the test

* use base64url encoding in encrypted notification data
2022-04-18 08:57:55 +01:00
Evgeny Poberezkin f84439f79d
function to run TCP server without TLS (#354) 2022-04-18 08:56:08 +01:00
Evgeny Poberezkin 9d8a9c4fe4
interval notifications (TCRN command) (#352)
* notifications: periodic notifications

* agent: allow repeat token registrations, delete old tokens from notification server (e.g., when database is moved to another device)

* decrypt token verification code in the agent

* check token status, send TCRN on registration if it was enabled

* fix http2/apns response handling for error responses (also, APNS seems not to send content-length header?)
2022-04-17 10:34:51 +01:00
Evgeny Poberezkin 45ddecc4b8
APNS/HTTP2 push client for notifications server (#350)
* APN push client (WIP)

* APNS push client works

* TODO comments

* comment

* send notification and process the response

* config

* e2e encryption for notification parameter

* read apns key filename and ID from env

* connect APNS client to server, fix notification JSON encoding to use dash case

* do not connect to APNS on start to pass CI tests

* fix CI test

* remove redundant import
2022-04-14 11:33:17 +01:00
Evgeny Poberezkin 327f7112d0 Merge branch 'master' into notifications-server 2022-04-13 08:52:45 +01:00
Evgeny Poberezkin d38303d5f1
fix END from disconnected clients incorrectly removing the subscriptions, remove previous PING changes that attempted to solve the problem of lost subscriptions (#351)
* Revert "increase PING timeout, add PING failure count"

This reverts commit a89e019bb0.

* Revert "PING error now throws error to restart SMPClient for more reliable re-connection (#342)"

This reverts commit 62acbc4ad4.

* only process END from the currently active client

* log ignored END

* make PING sent every 15 sec and destroying connection on failure (for testing - to be reverted)

* make removing subscription atomic too

* Revert "make PING sent every 15 sec and destroying connection on failure (for testing - to be reverted)"

This reverts commit 5520b318a20cebb849cbd1872561f87d145b6a16.

* refactor, aggressive PING settings for testing

* revert PING breaking connection
2022-04-12 11:35:28 +01:00
Evgeny Poberezkin 65c77c78f3 Merge branch 'master' into notifications-server 2022-04-11 10:39:41 +01:00
Evgeny Poberezkin 6382367ec0 typo 2022-04-11 10:30:34 +01:00
Evgeny Poberezkin a89e019bb0 increase PING timeout, add PING failure count 2022-04-11 10:24:02 +01:00
Evgeny Poberezkin a638486bb3 add swift flag to package.yaml 2022-04-08 15:42:22 +01:00
Evgeny Poberezkin a211e67829 Merge branch 'master' into notifications-server 2022-04-08 08:51:36 +01:00
Evgeny Poberezkin 390e99ca95 rename cabal flag 2022-04-08 08:51:07 +01:00
Evgeny Poberezkin f577fcdacf
agent schema/methods/types/store methods for notifications tokens (#348)
* agent schema/methods/types/store methods for notifications tokens

* register notification token on the server

* agent commands for notification tokens

* refactor initial servers from AgentConfig

* agent store functions for notification tokens

* server STM store methods for tokens

* fix protocol client for ntfs (use generic handshake), minimal server and agent tests

* server command to verify ntf token
2022-04-08 08:47:04 +01:00
Moritz Angermann ac7ffc413e
Add Flag (#349)
* Update Parsers.hs

* Update simplexmq.cabal
2022-04-07 08:44:37 +01:00
Evgeny Poberezkin fb26916eea
ntf-server CLI, re-use SMP server CLI as a library (#347)
* ntf-server CLI, re-use SMP server CLI as a library

* add executable name
2022-04-03 10:37:32 +01:00
Evgeny Poberezkin 2eff717248 Merge branch 'master' into notifications-server 2022-04-02 16:19:45 +01:00
Evgeny Poberezkin d31958855f
ntf server implementation, updated ntf protocol, ntf client based on refactored protocol client, bare-bones SMP agent to manage ntf connections (to connect to ntf server) (#338)
* process ntf server commands

* when subscription is re-created and it was ENDed, resubscribe to SMP

* SMPClientAgent draft

* SMPClientAgent: remove double tracking of subscriptions

* subscriber frame

* PING error now throws error to restart SMPClient for more reliable re-connection (#342)

* increase TCP timeout to 5 sec

* add pragmas and vacuum db (#343)

* vacuum in each connection to enable auto-vacuum (#344)

* update protocol, token verification

* refactor SMPClient to ProtocoClient, to use with notification server protocol

* notification server client, managing notification clients in the agent

* stub for push payload

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
2022-04-02 16:14:19 +01:00
JRoberts 3ba1926b1e
remove manual vacuum (#346) 2022-04-01 17:16:18 +04:00
JRoberts c62730fe4c Revert "catch db connection error"
This reverts commit 1815e81c2e6973e0867ad199ca3dcc68afe9f265.
2022-04-01 16:39:32 +04:00
JRoberts bb99fdaaa2
catch db connection error (#345) 2022-04-01 09:52:13 +01:00
JRoberts a6ec93c38e
vacuum in each connection to enable auto-vacuum (#344) 2022-03-31 15:26:13 +04:00
JRoberts 33f822d72c
add pragmas and vacuum db (#343) 2022-03-31 14:51:59 +04:00
Evgeny Poberezkin b6e87e4a3e increase TCP timeout to 5 sec 2022-03-29 11:18:49 +01:00
Evgeny Poberezkin 62acbc4ad4
PING error now throws error to restart SMPClient for more reliable re-connection (#342) 2022-03-29 13:21:21 +04:00
Evgeny Poberezkin 4e1184d9eb Merge branch 'master' into notifications-server 2022-03-28 19:03:40 +01:00
Evgeny Poberezkin cd22e06b3a
use TMap for subscription maps (#341)
* use TMap for subscription maps

* refactor

* correction
2022-03-28 18:49:17 +01:00
Evgeny Poberezkin 6ef6bedc03
refactor/optimize server queue/message store (#340)
* refactor/optimize server queue/message store

* change fst to pattern match

* server store - wrap QueueRec into TVar
2022-03-28 10:29:21 +01:00
Evgeny Poberezkin c380431b94
resubscribe concurrently when subscription is resumed (#339)
* resubscribe concurrently when subscription is resumed

* use strict modifyTVar, refactor with TMap

* add inline

* refactor
2022-03-28 07:30:29 +01:00
Evgeny Poberezkin f466fa76e5
notifications: protocol, server (#335)
* notifications: protocol

* update protocol to include subscription ID and DH public key

* update protocol, started server

* add notification server subscription DH key

* use the same command type in notifications protocol, protocol parsing, server frame

* remove empty files
2022-03-27 08:36:00 +01:00
Evgeny Poberezkin f2409e7280 Merge branch 'master' into notifications-server 2022-03-26 21:25:43 +00:00