logstash-output-websocket_topics 2.1.8 → 2.1.9

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: d9e4c5eb5d4cc91603996d0d702155c0bcf0bf0a
4
- data.tar.gz: 09b24686fbb1ea1e85bae41044d048ae7147634d
3
+ metadata.gz: 338fd64ac8c5da5276c2f72482df84fad68e214a
4
+ data.tar.gz: cb2898519383759bab5e2577ae509f2e754128f5
5
5
  SHA512:
6
- metadata.gz: d1a05e95f40bee08aabcc266b36b81b8ea26c94bd71a96282c1a6c6948ed9e11abc09dc4db9edc786fa192b6777a624c3091cd7ec094a2f95ceabde155674a09
7
- data.tar.gz: 4526946065677fdf74229eb9a55410c80642da5e952f22cc73d618057efb30e06a58990385411210fd6df8cbf1dd853fe1b6f0bb003f2d88da8a2df5e8a9a52d
6
+ metadata.gz: c5bb6394e9e53dfc8f751b32dab8e0fa61a976e4485e1390d2ab8c5d1056cecdbef1104bf9af4b7aa60c8a475818059fbbd3e632d420103bda3b864ccfb4200f
7
+ data.tar.gz: 87274dd58434fe740fb53edbbcef0451237114c26a163b02a0977a37de4559d5824921c6467fca87ee358fc8bcbffe0842d447a19d76d1c8af9b315feb37ec47
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
+ require "json"
2
3
  require "logstash/namespace"
3
4
  require "logstash/outputs/base"
4
5
 
5
-
6
6
  # This output runs a websocket server and publishes any
7
7
  # messages to all connected websocket clients.
8
8
  #
@@ -18,16 +18,10 @@ class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
18
18
  # The port to serve websocket data from
19
19
  config :port, :validate => :number, :default => 3232
20
20
 
21
- def make_pubsub(topic)
22
- pubsub = Logstash::Outputs::WebSocket::Pubsub.new
23
- pubsub.logger = @logger
24
- end
25
-
26
21
  public
27
22
  def register
28
23
  require "ftw"
29
- require "logstash/outputs/websocket/app"
30
- require "logstash/outputs/websocket/pubsub"
24
+ require "logstash/outputs/websocket_topics/app"
31
25
  @channels = {}
32
26
  @server = Thread.new(@channels) do |channels|
33
27
  begin
@@ -44,12 +38,15 @@ class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
44
38
  public
45
39
  def receive(event)
46
40
  topic = event['topic']
41
+ json = JSON.generate(event)
47
42
  if @channels.has_key?(topic)
48
- @channels[topic].publish(event.to_json)
43
+ @channels[topic].publish(json)
49
44
  else
50
- pubsub = make_pubsub(topic)
45
+ require "logstash/outputs/websocket_topics/pubsub"
46
+ pubsub = LogStash::Outputs::WebSocket::Pubsub.new
47
+ pubsub.logger = @logger
51
48
  @channels[topic] = pubsub
52
- pubsub.publish(event.to_json)
49
+ pubsub.publish(json)
53
50
  end # if
54
51
  end # def receive
55
52
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/namespace"
3
- require "logstash/outputs/websocket"
3
+ require "logstash/outputs/websocket_topics"
4
4
 
5
5
  class LogStash::Outputs::WebSocket::Pubsub
6
6
  attr_accessor :logger
@@ -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.8'
4
+ s.version = '2.1.9'
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"
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
3
+ require "logstash/outputs/websocket_topics"
4
+
5
+ describe "output/websocket_topics" do
6
+
7
+ subject(:output) { LogStash::Outputs::WebSocket.new }
8
+
9
+ it "should register" do
10
+ expect {output.register}.to_not raise_error
11
+ end
12
+
13
+ it "should receive a simple message with a topic" do
14
+ output.register()
15
+ expect {output.receive({ "topic" => "blah" })}.to_not raise_error
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-websocket_topics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Osheroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core
@@ -98,11 +98,11 @@ files:
98
98
  - LICENSE
99
99
  - NOTICE.TXT
100
100
  - README.md
101
- - lib/logstash/outputs/websocket/app.rb
102
- - lib/logstash/outputs/websocket/pubsub.rb
103
101
  - lib/logstash/outputs/websocket_topics.rb
102
+ - lib/logstash/outputs/websocket_topics/app.rb
103
+ - lib/logstash/outputs/websocket_topics/pubsub.rb
104
104
  - logstash-output-websocket_topics.gemspec
105
- - spec/outputs/websocket_spec.rb
105
+ - spec/outputs/websocket_topics_spec.rb
106
106
  homepage: ''
107
107
  licenses:
108
108
  - Apache License (2.0)
@@ -130,4 +130,4 @@ signing_key:
130
130
  specification_version: 4
131
131
  summary: This output runs a websocket server and publishes any messages to those conencted clients that have subscribed to the topic being published.
132
132
  test_files:
133
- - spec/outputs/websocket_spec.rb
133
+ - spec/outputs/websocket_topics_spec.rb
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/devutils/rspec/spec_helper"
3
- require "logstash/outputs/websocket"
4
-
5
- describe "output/websocket" do
6
-
7
- subject(:output) { LogStash::Outputs::WebSocket.new }
8
-
9
- it "should register" do
10
- expect {output.register}.to_not raise_error
11
- end
12
- end