GithubHelp home page GithubHelp logo

pusher-community / gs-pusher-rails Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 1.0 458 KB

Get started with Pusher and Ruby on Rails

Ruby 60.28% JavaScript 1.62% CoffeeScript 2.07% CSS 4.06% HTML 31.97%

gs-pusher-rails's Introduction

Getting Started: Pusher and Rails

A getting started example when using the Pusher Ruby HTTP API library with Rails.

This repo gives you the absolute basics required to get started. It doesn't provide you with full examples so should be used as a quick getting started template or a reference.

Examples

Todo:

  • Triggering the same event on multiple channels
  • How to trigger an event from your client (client events)
  • Querying application state

Installation

From the directory you've cloned into, install the example dependencies:

$ bundle install

Run the examples

Prior to running the Rails app you'll need some environmental variables to be set.

  • PUSHER_CHAT_APP_ID - your Pusher application ID
  • PUSHER_CHAT_APP_KEY - your Pusher application key
  • PUSHER_CHAT_APP_SECRET - your Pusher application secret

You can do this from the command line as part of running the application:

# Bash (OS X and Linux)
PUSHER_CHAT_APP_ID=YOUR_APP_ID PUSHER_CHAT_APP_KEY=YOUR_APP_KEY PUSHER_CHAT_APP_SECRET=YOUR_APP_SECRET rails s

# Windows command prompt:
set PUSHER_CHAT_APP_ID=YOUR_APP_ID&& set PUSHER_CHAT_APP_KEY=YOUR_APP_KEY&& set PUSHER_CHAT_APP_SECRET=YOUR_APP_SECRET&& rails s

# Windows PowerShell:
$env:PUSHER_CHAT_APP_ID="YOUR_APP_ID"; $env:PUSHER_CHAT_APP_KEY="YOUR_APP_KEY"; $env:PUSHER_CHAT_APP_SECRET="YOUR_APP_SECRET"; rails s
 

Or, probably much more easily, with the help of foreman and by setting these values in a .env file:

PUSHER_CHAT_APP_ID=YOUR_APP_ID
PUSHER_CHAT_APP_KEY=YOUR_APP_KEY
PUSHER_CHAT_APP_SECRET=YOUR_APP_SECRET

Then run:

PORT=3000 foreman start

Foreman will load those values automatically when you start the Rails app.

Navigate to localhost:3000 (or the URL you see logged to the console) and take a look at the examples. View the JavaScript console for a log from the Pusher JavaScript library.

Deploy to Heroku

Deploy

Make sure you've got the required environmental variables set up!

gs-pusher-rails's People

Contributors

jackfranklin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

develaper

gs-pusher-rails's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.