socketclusterclient 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/commands.txt +47 -0
- data/examples/channel.rb +10 -0
- data/lib/socketclusterclient/log.rb +17 -0
- data/lib/socketclusterclient/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 54151ff3f4b78b8735bf4ee1077a5049bf531251f9eb2757ae3bb05f7cc9a01b
|
4
|
+
data.tar.gz: 524f773575b515663d2fc4f4c2b675e3a06ed5c1a96ead75b1152597b6db2e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c14208cc51df2d7affd51458a9c044c68c835da65a9835aa332dba78a0832a77768d27cf4ddef970a520d2d4de6e34bb4aa9628c6b74155fbd3464418a539a0
|
7
|
+
data.tar.gz: 4db2565dfe81d13d623f84d939436f5b2d7290dc75ac7a42c76095291516d1dc9fc29e3cd0349a99513bde82179cdf234bc9b12073c90f5ffb7441afd5de623f
|
data/commands.txt
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
To work with ruby you need to install ruby and its dependencies:
|
2
|
+
|
3
|
+
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
4
|
+
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
5
|
+
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
6
|
+
|
7
|
+
$ sudo apt-get update
|
8
|
+
$ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
|
9
|
+
|
10
|
+
Installing ruby using rvm:
|
11
|
+
|
12
|
+
$ sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
|
13
|
+
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
14
|
+
$ curl -sSL https://get.rvm.io | bash -s stable
|
15
|
+
$ source ~/.rvm/scripts/rvm
|
16
|
+
$ rvm install 2.2.0
|
17
|
+
$ rvm use 2.2.0 --default
|
18
|
+
$ ruby -v
|
19
|
+
|
20
|
+
Now, to use the gem you need to:
|
21
|
+
|
22
|
+
$ gem install socketclusterclient
|
23
|
+
|
24
|
+
You can now use the gem directly by requiring it:
|
25
|
+
|
26
|
+
require 'socketclusterclient'
|
27
|
+
|
28
|
+
However, if you want to contribute to the gem, you need to have a git account and setup git:
|
29
|
+
|
30
|
+
$ git config --global color.ui true
|
31
|
+
$ git config --global user.name "YOUR NAME"
|
32
|
+
$ git config --global user.email "YOUR@EMAIL.com"
|
33
|
+
$ ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"
|
34
|
+
|
35
|
+
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it in your github account SSH/GPG Keys:
|
36
|
+
|
37
|
+
$ cat ~/.ssh/id_rsa.pub
|
38
|
+
|
39
|
+
Once you've done this, you can check and see if it worked:
|
40
|
+
|
41
|
+
$ ssh -T git@github.com
|
42
|
+
|
43
|
+
Once you are ready with the setup, you can clone the repository using:
|
44
|
+
|
45
|
+
$ git clone https://github.com/OpenSocket/socketcluster-client-ruby.git
|
46
|
+
|
47
|
+
Now, you need to just install all the dependency and then you are all set to start contributing to https://github.com/OpenSocket/socketcluster-client-ruby.git
|
data/examples/channel.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'socketclusterclient'
|
2
4
|
|
3
5
|
on_connect = -> { puts 'on connect got called' }
|
@@ -6,6 +8,14 @@ on_disconnect = -> { puts 'on disconnect got called' }
|
|
6
8
|
|
7
9
|
on_connect_error = -> { puts 'on connect error got called' }
|
8
10
|
|
11
|
+
on_connection_timeout = -> { puts 'connection timeout happened' }
|
12
|
+
|
13
|
+
on_connection_dropped = -> { puts 'connection dropped from existing sockets' }
|
14
|
+
|
15
|
+
on_connection_encrypted = -> { puts 'Connection is encrypted from server, check the encryption key received' }
|
16
|
+
|
17
|
+
on_connection_status_changed = -> { puts 'Connection status has changed' }
|
18
|
+
|
9
19
|
ack_subscribe = lambda do |channel, error, _object|
|
10
20
|
puts "Subscribed successfully to channel => #{channel}" if error == ''
|
11
21
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#
|
2
4
|
# Module Logger provides an interface to log events
|
3
5
|
#
|
@@ -44,4 +46,19 @@ module Log
|
|
44
46
|
def enable_logging
|
45
47
|
initialize_logger
|
46
48
|
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Method to set logging level
|
52
|
+
# :debug < :info < :warn < :error < :fatal < :unknown
|
53
|
+
#
|
54
|
+
#
|
55
|
+
#
|
56
|
+
def set_logging_level(level)
|
57
|
+
level = level.to_s.downcase
|
58
|
+
if %w[debug info warn error fatal unknown].include?(level)
|
59
|
+
@logger.level = level.to_sym
|
60
|
+
else
|
61
|
+
@logger.warn('Invalid logger level')
|
62
|
+
end
|
63
|
+
end
|
47
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socketclusterclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maanav Shah
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-02-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- Rakefile
|
104
104
|
- bin/console
|
105
105
|
- bin/setup
|
106
|
+
- commands.txt
|
106
107
|
- examples/authentication.rb
|
107
108
|
- examples/channel.rb
|
108
109
|
- examples/emitter.rb
|
@@ -137,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
138
|
- !ruby/object:Gem::Version
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
|
-
|
141
|
-
rubygems_version: 2.6.14
|
141
|
+
rubygems_version: 3.0.6
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Ruby client for socketcluster
|