Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Jackson; Modify README;

  • Loading branch information...
commit dd55c542dcdf5de3fa69ecc43dcc1ffd551cad00 1 parent 7463b16
@marekjelen marekjelen authored
View
1  .gitignore
@@ -1,3 +1,4 @@
*.iml
*.gem
.bundle
+.idea
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm use jruby-1.6.5@wildcloud
View
47 README.md
@@ -2,6 +2,51 @@
Service providing websockets to applications deployed in Wildcloud platform
-# License
+## Status
+
+Proof of concept implementation.
+
+The service does not *yet* implement the interface as described below.
+
+## Client interface
+
+* SockJS
+
+## Interface
+
+Application authorizes client with _secret_ application id and custom client id. The service returns socket_id, that
+should be used for identifying that specific client (e.g. user of a web application).
+
+ POST /authorize/application_id/client_id
+
+with parameters in it's body, encoded as JSON.
+
+ {"callback":"http://www.yourapplication.com/ws/callback"}
+
+To the callback url, a message published by client to the service, will be forwarded
+
+ POST http://www.yourapplication.com/ws/callback
+
+with content of the message as the request body with other parameters encoded as JSON
+
+ {"message": "some message", "session": "session_id", "client": "client_id"}
+
+where session id represent single connection between the client and this service (e.g. one window or tab in a browser).
+
+To publish a message, the application posts a request to the service with socket_id and optional session_id
+
+ POST /publish/socket_id
+
+or
+
+ POST /publish/socket_id/session_id
+
+with JSON encoded body containing the message and optional parameters.
+
+ {"message": "some message"}
+
+The service then forwards the message to the client (all sessions or just a specific one).
+
+## License
Project is licensed under the terms of the Apache 2 License.
View
4 bin/wildcloud-websockets
@@ -18,10 +18,6 @@ require 'rubygems'
$: << File.expand_path('../../lib', __FILE__)
-require 'java'
-
-require File.expand_path('../../ext/netty', __FILE__)
-
require 'wildcloud/websockets/websockets/server'
@server = Wildcloud::Websockets::Websockets::Server.new
View
BIN  ext/jackson-core.jar
Binary file not shown
View
BIN  ext/jackson-mapper.jar
Binary file not shown
View
3  ext/versions.txt
@@ -1 +1,2 @@
-Netty 3.3.0.Final
+Netty - 3.3.0.Final
+Jackson - asl-1.9.4
View
2  lib/wildcloud/websockets/websockets/handler.rb
@@ -58,7 +58,7 @@ def messageReceived(context, event)
@response_content_length = 0
@response = DefaultHttpResponse.new(HttpVersion::HTTP_1_1, HttpResponseStatus::OK)
@response.set_header('Access-Control-Allow-Credentials', 'true')
- @response.set_header('Access-Control-Allow-Origin', '*')
+ @response.set_header('Access-Control-Allow-Origin', 'http://localhost')
@response.set_header('Connection', 'keep-alive')
@response.set_header('Content-Type', 'application/json; charset=UTF-8')
cookie = request_header('Cookie')
View
6 lib/wildcloud/websockets/websockets/java.rb
@@ -12,6 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+require 'java'
+
+require File.expand_path('../../../../../ext/netty', __FILE__)
+require File.expand_path('../../../../../ext/jackson-core', __FILE__)
+require File.expand_path('../../../../../ext/jackson-mapper', __FILE__)
+
module Wildcloud
module Websockets
module Websockets
Please sign in to comment.
Something went wrong with that request. Please try again.