Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
andreimerlescu committed Aug 31, 2019
1 parent 7b9f78f commit 058249e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
41 changes: 28 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ gem install faye_service
**Github Repo**: https://github.com/amerlescucodez/faye-docker

**Docker Container**: https://cloud.docker.com/repository/registry-1.docker.io/amerlescucodez/docker-faye-redis
**Docker Container**: https://hub.docker.com/r/amerlescucodez/docker-faye-ruby

```
docker pull amerlescucodez/docker-faye-ruby
```

> You can use this `docker-compose.yaml` template to get the necessary requirements running locally:
Expand All @@ -46,11 +50,18 @@ services:
- redis
depends_on:
- redis
restart: always
restart: unless-stopped
ports:
- 4242:4242
- 4443:4443
expose:
- 4242
- 4443
env_file:
- .faye.env.development
volumes:
- ./host/path/to/ssl/certificates:/etc/ssl/certs/faye
- ./host/path/to/faye/tokens:/usr/local/faye/tokens
networks:
- primary
Expand All @@ -67,14 +78,16 @@ docker-compose up -d

> And then be able to access https://localhost:4242/faye/client.js
**Note**: If you're placing Faye inside a docker-compose file that also includes your application, you need to make sure that

## Installation into Rails

**Important Note**: If you wish to use SSL with Faye, please change all occurences of `http://localhost:4242` to `https://localhost:4443` (or to the specified values in your instance of faye.) Please read this documentation about SSL support: https://github.com/amerlescucodez/faye-docker#adding-ssl-certificate
**Important Note**: If you wish to use SSL with Faye, please change all occurences of `http://localhost:4242` to `https://localhost:4443` (or to the specified values in your instance of faye.) Please read this documentation about SSL support: https://github.com/amerlescucodez/faye-docker-ruby#generate-ssl-certificate

> Open your `Gemfile` and add the following dependency:
```ruby
gem "faye_service", "~> 1.0.0"
gem "faye_service", "~> 1.0.1"
```

> Create the faye configuration file:
Expand All @@ -83,14 +96,11 @@ Edit `config/initializers/faye.rb`:

```ruby
require 'faye_service'

faye = FayeService.new
faye.config = {
url: "http://localhost:3000",
auth_token: "your_secret_auth_token",
auth_service: Rails.application.class.parent_name,
log_level: :warn
}
FayeService.configure do |config|
config.url = "http://localhost:4242"
config.auth_token = ""
config.auth_service = ""
end
```

## Sending Messages
Expand Down Expand Up @@ -162,9 +172,14 @@ end
<script type="text/javascript">
$(function() {
var faye = new Faye.Client('http://localhost:4242/faye');
faye.subscribe("/my/awesome/channel", function(data) {
varsubscription = faye.subscribe("/my/awesome/channel", function(data) {
alert(data);
});
subscription.then(function(message){
console.log("Successfully subscribed to Faye.");
}, function(error){
console.log("Error connecting to Faye.");
});
});
</script>
```
Expand Down
7 changes: 5 additions & 2 deletions faye-service.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require File.expand_path('../lib/faye_service/version', __FILE__)
# require File.expand_path('../lib/faye_service/version', __FILE__)
$:.push File.expand_path("../lib", __FILE__)
require "faye_service/version"


Gem::Specification.new do |s|
s.authors = ["Andrei Merlescu"]
s.email = ["andrei+github@merlescu.net"]
s.description = s.summary = "Simple interface for Faye service messaging."
s.homepage = "https://github.com/amerlescucodez/faye-service-gem"
s.license = "MIT"
s.files = `git ls-files | grep -Ev '^(myapp|examples)'`.split("\n")
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
s.name = "faye_service"
s.require_paths = ["lib"]
s.version = FayeService::VERSION
Expand Down

0 comments on commit 058249e

Please sign in to comment.