logstash-output-websocket_topics 2.1.9 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f3e272a1f160410cceba0a55c51746cd01f61ba
|
4
|
+
data.tar.gz: eae59914f27334e123e3585ae15780a859cc3c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daae8852cd32d24aff4c58811ab9462d4e6babc38f717ec238ac0b08419ea34450b931c3e0ce766e8318e11609fd8025cdebb94595cb6ee762347c9aa6d6543a
|
7
|
+
data.tar.gz: 54b0eb5e51fc8f3be45757557307586a2a1378757139986eec694ac05db3c98287df7abcb219bc22483a850aa5b705f39b05f3fefbaf1f9721e42c79c200dc43
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require "json"
|
2
3
|
require "logstash/namespace"
|
3
4
|
require "logstash/outputs/websocket_topics"
|
4
5
|
require "sinatra/base"
|
@@ -19,12 +20,12 @@ class LogStash::Outputs::WebSocket::App < Sinatra::Base
|
|
19
20
|
@logger.debug("New websocket client")
|
20
21
|
stream(:keep_open) do |out|
|
21
22
|
ws.each do |payload|
|
22
|
-
json = payload
|
23
|
-
if json
|
24
|
-
@channels[json
|
23
|
+
json = JSON.parse(payload)
|
24
|
+
if json['type'] == 'subscribe-topic'
|
25
|
+
@channels[json['topic']].subscribe do |event|
|
25
26
|
ws.publish(event)
|
26
27
|
end
|
27
|
-
elsif json
|
28
|
+
elsif json['type'] == 'subscribe-all'
|
28
29
|
@channels.values.each do |channel|
|
29
30
|
channel.subscribe do |event|
|
30
31
|
ws.publish(event)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-websocket_topics'
|
4
|
-
s.version = '2.1.
|
4
|
+
s.version = '2.1.10'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This output runs a websocket server and publishes any messages to those conencted clients that have subscribed to the topic being published."
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|