Chat Plugin Documentation¶
Overview¶
Plugin Objective¶
The Peek Chat plugin provides simple chat functionality between users in the Peek system and integrations in external systems.
Integrations with external systems are handled by other plugins, which can use the API for this chat plugin.
Originally this plugin was designed to send messages between the power grid control room and field engineers.
Plugin Uses¶
Simple communications with external systems.
API Reference¶
peek_plugin_chat¶
-
peek_plugin_chat.
peekFieldEntryHook
() → Type[peek_plugin_base.client.PluginClientEntryHookABC.PluginClientEntryHookABC][source]¶
-
peek_plugin_chat.
peekLogicEntryHook
() → Type[peek_plugin_base.server.PluginLogicEntryHookABC.PluginLogicEntryHookABC][source]¶
-
peek_plugin_chat.
peekOfficeEntryHook
() → Type[peek_plugin_base.client.PluginClientEntryHookABC.PluginClientEntryHookABC][source]¶
(P) server¶
(M) ChatApiABC¶
-
class
peek_plugin_chat.server.ChatApiABC.
ChatApiABC
[source]¶ Bases:
object
-
createChat
(fromExtUserId: str, toUserIds: List[str]) → None[source]¶ Create a Chat
Send a new chat message to a user.
Parameters: - fromExtUserId – The external userId sending the message
- toUserIds – The Peek userIds to send the message to
-
receiveMessages
(toExtUserId: str) → rx.subjects.subject.Subject[source]¶ Receive Messages
Get the observable that will be fired when new messages are received.
It will be fired with C{ReceivedMessage}
Parameters: toExtUserId – The external systems userId, that the plugin wants to observe messages for. This is just identifier unique to the external system. Returns: A RxJS Observable that will notify observers when a message arrives for that external system.
-
-
class
peek_plugin_chat.server.ChatApiABC.
NewMessage
(fromExtUserId: str, fromExtUserName: str, toUsers: List[peek_plugin_chat.server.ChatApiABC.NewMessageUser], message: str, priority: int = 2)[source]¶ Bases:
object
New Message
This class represents a new message that another plugin can send to a user.
Parameters: - fromExtUserId – The external user id of the user sending the message. This doesn’t have to match a userId in the peek_core_user plugin.
- fromExtUserName – The name of the external user (or system) sending the message.
- toUsers – A list of users to send the message to.
- message – The message to send to the user.
- priority – The priority of this message, some messages may be emergency messages.
-
PRIORITY_EMERGENCY
= 1¶ Emergency priority for message
-
PRIORITY_NORMAL_FLEETING
= 2¶ Normal priority for a message, the alert will be fleeting
-
PRIORITY_NORMAL_STICKY
= 3¶ Normal priority for message, the alert will be sticky
-
class
peek_plugin_chat.server.ChatApiABC.
NewMessageUser
(toUserId: str, onReadPayload: Optional[bytes] = None, onDeliveredPayload: Optional[bytes] = None)[source]¶ Bases:
object
New Message User
This class represents a user that the message will be sent to.
Parameters: - toUserId – The peek userId that matches a user in peek_core_user plugin.
- onReadPayload – (Optional) The payload that will be delivered locally on Peek Server when the user has read the message.
-
onDeliveredPayload
= None¶ On Delivered Payload
-
class
peek_plugin_chat.server.ChatApiABC.
ReceivedMessage
(fromUserId: str, allUserIds: List[str], message: str, priority: int)[source]¶ Bases:
object
Received Message
This class represents a message sent from a peek user to an external system.
Parameters: - fromUserId – The peek userId sending the message.
- allUserIds – All the userIds in this chat.
- message – The message sent by the peek user.
- priority – The priority of this message sent.
-
PRIORITY_EMERGENCY
= 1¶
-
PRIORITY_NORMAL_FLEETING
= 2¶
-
PRIORITY_NORMAL_STICKY
= 3¶