web_socket_chat_server 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 240864386719a853161a794b90a66f287eda2df2
4
- data.tar.gz: 4af6181438cb88427ae8e0614488ad3a89511eed
3
+ metadata.gz: e0c88249be58e9f3d5eda9919f1f7f94f7495382
4
+ data.tar.gz: 4a330062bf7fe3355bb9994bb0bd70c40b0534f1
5
5
  SHA512:
6
- metadata.gz: e9aa2b30d0290fb9afd02e0cde20f1373c828adfb5122e57afe20ab0c587a9a5e24dcc527c6d9c18ce0e3069cb4319bef86065f1c9bfc543eed21aeb4505d357
7
- data.tar.gz: ceb1e274764aeabde2e05433a0afe5b899b2d041ef447066b30050f4bf2121e1c354e33409eee0ac521cea394d7108117960946e2232caa195b798b73bbeb431
6
+ metadata.gz: 91ad776dc65cc1db7f9a19e53ce490da8839659d51c6ad5df14740bd7d7ef21c990d43f52cf0173750f5f18dd16cadf2777b653267475e134048722e0dbf29ee
7
+ data.tar.gz: 150e679866f8569ab1d21778e8a4871f6ad967bac92b9da325c13ce9849122a186f9b0bbf3b4e753f0aeddeb1259507bb961ac1de894030e17b0a46b0500c5cc
data/README.md CHANGED
@@ -85,3 +85,6 @@ The server will respond with a JSON hash of the format {command: ”…”, data
85
85
 
86
86
  {command: ”user_disconnected”, data: ”username”, information: ”Some details.”}
87
87
  ```
88
+
89
+ ### Want to write the client in JS?
90
+ Use the demo attached to this repository or check this out http://abulewis.com/blog/writing-a-wrapper-websocket-client-class-in-js/
@@ -33,7 +33,7 @@ class ChatServer
33
33
  # * +:tls-options+ (Optional) - The TLS options as allowed by em-websocket (https://github.com/igrigorik/em-websocket#secure-server).
34
34
  # * +:secure_proxy+ (Optional) - When ruinng behind a SSL proxy (https://github.com/igrigorik/em-websocket#running-behind-an-ssl-proxyterminator-like-stunnel).
35
35
  # * +:admins+ (Optional) - In order to have admins (for banning users). Pass an array of ChatUser objects to this key. The ChatUser object contains of username and password attributes. The username must consist of at least 3 alphanumeric characters. The password must at least consist of 6 alphanumeric characters.
36
- # * +:allowed_origin (Optional) - Allow connections only from the passed URI. The URI should be the domain and/or port (depending on the server setup), in which your application is operating.
36
+ # * +:allowed_origin+ (Optional) - Allow connections only from the passed URI. The URI should be the domain and/or port (depending on the server setup), in which your application is operating.
37
37
  def initialize(args = {:host => "0.0.0.0", :port => 8080})
38
38
  @server_started = false
39
39
  raise ArgumentError, "The :host parameter is required" unless args.has_key?(:host)
@@ -44,17 +44,18 @@ class ChatServer
44
44
  @origin = args[:allowed_origin] if args.has_key?(:allowed_origin)
45
45
 
46
46
  @max_connections = args[:max_connections].to_s.to_i
47
- @max_connections = 100 if @max_connections <= 1
47
+ @max_connections = 100 if @max_connections <= 0
48
+
48
49
  @host = args[:host]
49
50
  @port = args[:port]
50
- @server_started = false
51
+
51
52
  @admins = []
52
53
  @banned_usernames = []
53
54
  @connected_users = Hash.new
54
-
55
55
  @server_options = Hash.new
56
+
56
57
  @server_options[:host] = @host
57
- @server_options[:port] = @port.to_i
58
+ @server_options[:port] = @port.to_s.to_i
58
59
  @server_options[:secure] = args[:secure] if args.has_key?(:secure)
59
60
  @server_options[:tls_options] = args[:tls_options] if args.has_key?(:tls_options)
60
61
  @server_options[:secure_proxy] = args[:secure_proxy] if args.has_key?(:secure_proxy)
@@ -1,3 +1,3 @@
1
1
  module WebSocketChatServer
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_socket_chat_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jone Samra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-09 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-websocket