diff --git a/docs/rfcs/2025-10-20-chat-relays.md b/docs/rfcs/2025-10-20-chat-relays.md
index 0d53065017..5145397b27 100644
--- a/docs/rfcs/2025-10-20-chat-relays.md
+++ b/docs/rfcs/2025-10-20-chat-relays.md
@@ -215,7 +215,7 @@ par With each relay
R ->> O: 10. Accept request
(x.grp.relay.acpt
incl. relay link)
note over O, R: Priority connection
with relay is ready
O ->> OSMP: 11. Update short link
(add relay link)
- O ->> R: 12. Connect via relay link
+ O ->> R: 12. Connect via relay link
(share same owner key)
note over O, R: Owner: Messages connection with relay is ready,
relay link is tested
Relay: Relay link is active
end
create participant M as Member
@@ -224,7 +224,11 @@ O -->> M: 13. Share group short link
(social, out-of-band)
note over O, M: New member connects
M ->> OSMP: 14. Retrieve short link data
-M ->> R: 15. Connect via relay link(s)
+par Priority connection
+ M ->> R: 15a. Connect via relay link
+and Messages connection
+ M ->> R: 15b. Connect via relay link
(share same member key/
identifier to correlate)
+end
note over O, M: Message forwarding
@@ -233,6 +237,11 @@ R ->> M: 17. Forward message
M ->> M: 18. Deduplicate message
```
+Notes:
+
+- Invitation sent in step 12 should contain same key as in group link, for relay to match connection to the same owner and "active" relay link (add to `XContact` message).
+
+- Add new connection entity, special for groups with relay, referencing member record - parallel to first member connection.
## Protocol for removing chat relay from group, restoring connection to group
diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/M20251016_chat_relays.hs b/src/Simplex/Chat/Store/SQLite/Migrations/M20251016_chat_relays.hs
index 2cc8ce5e88..65fb62ad03 100644
--- a/src/Simplex/Chat/Store/SQLite/Migrations/M20251016_chat_relays.hs
+++ b/src/Simplex/Chat/Store/SQLite/Migrations/M20251016_chat_relays.hs
@@ -51,6 +51,9 @@ ALTER TABLE group_members ADD COLUMN group_relay_id INTEGER REFERENCES group_rel
CREATE INDEX idx_group_members_group_relay_id ON group_members(group_relay_id);
ALTER TABLE groups ADD COLUMN relay_own_status TEXT;
+
+ALTER TABLE connections ADD COLUMN group_member_id_low_priority INTEGER REFERENCES group_members ON DELETE CASCADE;
+CREATE INDEX idx_connections_group_member_id_low_priority ON connections(group_member_id_low_priority);
|]
down_m20251016_chat_relays :: Query
@@ -70,4 +73,7 @@ DROP INDEX idx_group_members_group_relay_id;
ALTER TABLE group_members DROP COLUMN group_relay_id;
ALTER TABLE groups DROP COLUMN relay_own_status;
+
+DROP INDEX idx_connections_group_member_id_low_priority;
+ALTER TABLE connections DROP COLUMN group_member_id_low_priority;
|]
diff --git a/src/Simplex/Chat/Types.hs b/src/Simplex/Chat/Types.hs
index 06e2dcb13c..9131a28443 100644
--- a/src/Simplex/Chat/Types.hs
+++ b/src/Simplex/Chat/Types.hs
@@ -974,24 +974,35 @@ data GroupRelay = GroupRelay
}
deriving (Eq, Show)
--- Status tracked by owner per relay
+-- -- Status tracked by owner per relay
+-- data GroupRelayStatus
+-- = GRSNew
+-- | GRSInvited
+-- | GRSAccepted
+-- | GRSAdded
+-- | GRSNotified
+-- | GRSConfirmed
+-- deriving (Eq, Show)
+
+-- -- Own status tracked by relay in a group
+-- data GroupRelayOwnStatus
+-- = GROSInvited
+-- | GROSLinkCreated
+-- | GROSAccepted
+-- | GROSNotified
+-- | GROSConfirmed
+
+-- TODO [chat relays] single type for statuses both on owner and relay side?
data GroupRelayStatus
- = GRSNew
+ = GRSNew -- only for owner
| GRSInvited
+ | GRSVerified -- only for relay
+ | GRSLinkCreated -- only for relay
| GRSAccepted
- | GRSAdded
- | GRSNotified
+ | GRSAdded -- only for owner
| GRSConfirmed
deriving (Eq, Show)
--- Own status tracked by relay in a group
-data GroupRelayOwnStatus
- = GROSInvited
- | GROSLinkCreated
- | GROSAccepted
- | GROSNotified
- | GROSConfirmed
-
data GroupSupportChat = GroupSupportChat
{ chatTs :: UTCTime,
unread :: Int64,