summaryrefslogtreecommitdiffstats
path: root/plugin/api.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-06-27 08:46:38 -0400
committerGitHub <noreply@github.com>2018-06-27 08:46:38 -0400
commitd7976549a0b45a42c04ac043a15677b7ca1228e9 (patch)
tree14940a3a61bbff407887a2d5afcd8ea71ab41fb1 /plugin/api.go
parent1e5c432e1029601a664454388ae366ef69618d62 (diff)
downloadchat-d7976549a0b45a42c04ac043a15677b7ca1228e9.tar.gz
chat-d7976549a0b45a42c04ac043a15677b7ca1228e9.tar.bz2
chat-d7976549a0b45a42c04ac043a15677b7ca1228e9.zip
MM-9674 Add plugin API for publishing custom WebSocket events (#8999)
* Add plugin API for publishing custom WebSocket events * Add clearer payload comment * Update comment
Diffstat (limited to 'plugin/api.go')
-rw-r--r--plugin/api.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go
index ed2bfa733..842cef4f6 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -113,6 +113,12 @@ type API interface {
// Delete will remove a key-value pair. Returns nil for non-existent keys.
KVDelete(key string) *model.AppError
+
+ // PublishWebSocketEvent sends an event to WebSocket connections.
+ // event is the type and will be prepended with "custom_<pluginid>_"
+ // payload is the data sent with the event. Interface values must be primitive Go types or mattermost-server/model types
+ // broadcast determines to which users to send the event
+ PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
}
var Handshake = plugin.HandshakeConfig{