Module PocketMeshPeer.Msg

Library message type and constructors for the public messages. Messages are meant to be passed to the update function.

type t;

Opaque variant type that represents library messages, both private and public.

let addPeer: Peer.Id.t => string => t;

addPeer(id, alias) message adds a new peer with ID id and local alias alias into the list of peers (friends). If a peer with the same ID is already added, nothing happens.

let updatePeer: Peer.Id.t => string => t;

updatePeer(id, alias) message updates local alias of peer with specified ID. If no such peer is found, nothing happens.

let removePeer: Peer.Id.t => t;

removePeer(id) message removes peer from the list of peers (friends) and from all groups.

let addGroup: PeersGroup.Id.t => string => (Crdt.t => Crdt.t) => t;

addGroup(id, alias, initializer) message adds a new group with ID id and local alias alias and initializes its replicated content using using initializer. If you want to keep it empty, simply pass a => a function.

let updateGroupAlias: PeersGroup.Id.t => string => t;

Message that updates local alias of the specified group.

let updateGroupContent: PeersGroup.Id.t => Crdt.t => t;

Message that updates contents of the group. Changes are debounced before propagating them to other group members.

let removeGroup: PeersGroup.Id.t => t;

Message that removes group with specified ID.

let addPeerToGroup: Peer.Id.t => PeersGroup.Id.t => PeerInGroup.groupPermissions => t;

Message that adds peer to the group with specified permissions. If the member already exists, its permissions get overwritten.

let updatePeerPermissions: Peer.Id.t => PeersGroup.Id.t => PeerInGroup.groupPermissions => t;

Message that updates permissions of the peer in the group. If the peer is not a member of the group, nothing happens.

let removePeerFromGroup: Peer.Id.t => PeersGroup.Id.t => t;

Message that removes peer from the group.

let updateSignalServerUrl: string => t;

Message that updates signal server URL and connects to it.

let removeThisPeerAndAllData: t;

Message that removes local identity and all data of the local replica (groups, their contents, list of friends, ...) and generates a clean new identity.