Skip to content

vivanov77/chat-in-rails5-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo chat for Rails 5 API-only using ActionCable and Devise Authentication.

http://stackoverflow.com/questions/39741120/how-to-use-devise-token-auth-with-actioncable-for-authenticating-user/43278860#43278860


If using sideway client (e.g. Simple Web Socket Client for Google Chrome):

  1. Sign in via HTTP as:

POST http://localhost:3000/api/auth/[email protected]&password=12345678

You'll get back these headers:

access-token: BndOS3qh9zJF4Nc4cfOFDA client: MhTwe4aEftJzOFv0dbO8Qg uid: [email protected]

Use these headers for Basic Websockets Authorisation:

  1. Connect: ws://localhost:3000/cable/?access-token=BndOS3qh9zJF4Nc4cfOFDA&client=MhTwe4aEftJzOFv0dbO8Qg&uid=[email protected]

  2. Subscribe: {"command":"subscribe","identifier":"{"channel":"RoomChannel","access-token":"BndOS3qh9zJF4Nc4cfOFDA","client":"MhTwe4aEftJzOFv0dbO8Qg","uid":"[email protected]"}"}

  3. Send message: {"command":"message","identifier":"{"channel":"RoomChannel","access-token":"BndOS3qh9zJF4Nc4cfOFDA","client":"MhTwe4aEftJzOFv0dbO8Qg","uid":"[email protected]"}","data":"{"name":"debug","content":"debug","action":"process_message_on_server"}"}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published