sockeye-server 0.1.0 → 0.1.1

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: 94e44f2887c4211da9337702430f0359552f8e04
4
- data.tar.gz: 8db3c1a6baf06de44be4a9b7ac81b70038ed23d8
3
+ metadata.gz: 218f205675403a58d505409d4dc347228a0a23aa
4
+ data.tar.gz: 5dd85809613411a109f1a3833b476effed102867
5
5
  SHA512:
6
- metadata.gz: 1ea7c8ca763a19809c246c5761d29ee78098875eccd4d17531805d74b9b767edafeda9c869f3d09114511e4d75f6fbdb9f91041e1f566c5eaee51b5687f5dd5e
7
- data.tar.gz: b29d9251f4beb15c21e3f2e016ed0c0b6736f5fd90e6011d43580623bf17f3a7c05727663c46ee1f540ed020a0dc561a54139fe17b66ad7f73db176a4c4bcc70
6
+ metadata.gz: 9cc764ad8fc80112c960221fd85bda244fdf09d980a36ce10353dfcfcb82ba5c10962b28ea4956fcc73383b841621a82906f9d736b53dc5da43a65a9def23018
7
+ data.tar.gz: 46efb591910b6eaf32f1e0dbd68f6faab9abba8a4351900c4e18af098bcc390e58ce8e328353a1f0323fbb79edfd87b22d083f29bd270dbb6d6c48de13a9e3a6
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Sockeye::Server
1
+ # 🐟 Sockeye::Server
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sockeye/server`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This project is currently under development, and is not usable. Please check back soon.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,17 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ ```ruby
24
+ # You probably want to make an API call to somewhere here to verify the authenticity of the token.
25
+ # If it is OK, return their user id or some unique identifier, otherwise return nil.
26
+ #
27
+ def authenticate(token)
28
+ return token
29
+ end
30
+
31
+ server = Sockeye::Server.new(host: "sockeye.local", port: 8443, secret_token: "SUPER_STRONG_SECURITY_TOKEN", authentication_method: Proc.new {|token| authenticate(token)})
32
+ server.listen
33
+ ```
26
34
 
27
35
  ## Development
28
36
 
@@ -1,4 +1,3 @@
1
- require "sockeye/server/version"
2
1
  require 'json'
3
2
  require 'eventmachine'
4
3
  require 'websocket-eventmachine-server'
@@ -62,7 +61,7 @@ module Sockeye
62
61
  next unless identified_connections.is_a? Array
63
62
  identified_connections.each do |connection|
64
63
  begin
65
- connection.send({payload: payload, status: 200}.to_json, :type => :text)
64
+ connection.send({payload: payload, status: payload.dig(:status) || 200}.to_json, :type => :text)
66
65
  rescue
67
66
  end
68
67
  end
@@ -111,7 +110,7 @@ module Sockeye
111
110
  #
112
111
  when :deliver
113
112
  if message_json[:secret_token] == self.secret_token
114
- deliver_to_many(payload: message_json[:payload], identifiers: message_json[:identifiers])
113
+ deliver_to_many(payload: message_json[:payload], identifiers: [message_json[:identifiers]].flatten)
115
114
  ws.send({payload: "payload pushed", status: 201}.to_json, :type => :text)
116
115
  ws.close
117
116
  else
@@ -1,11 +1,10 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'sockeye/server/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "sockeye-server"
8
- spec.version = Sockeye::Server::VERSION
7
+ spec.version = "0.1.1"
9
8
  spec.authors = ["Jack Hayter"]
10
9
  spec.email = ["jack.hayter@googlemail.com"]
11
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sockeye-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Hayter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,7 +95,6 @@ files:
95
95
  - bin/console
96
96
  - bin/setup
97
97
  - lib/sockeye/server.rb
98
- - lib/sockeye/server/version.rb
99
98
  - sockeye-server.gemspec
100
99
  homepage: https://github.com/HockeyCommunity/sockeye-server
101
100
  licenses:
@@ -117,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
116
  version: '0'
118
117
  requirements: []
119
118
  rubyforge_project:
120
- rubygems_version: 2.6.10
119
+ rubygems_version: 2.6.11
121
120
  signing_key:
122
121
  specification_version: 4
123
122
  summary: A websockets based server for payload delivery to clients
@@ -1,5 +0,0 @@
1
- module Sockeye
2
- module Server
3
- VERSION = "0.1.0"
4
- end
5
- end