GithubHelp home page GithubHelp logo

beyll / chat-engine-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pubnub/chat-engine-server

0.0 0.0 0.0 4.1 MB

ChatEngine REST API as a PubNub Function

Home Page: http://www.pubnub.com/developers/chat-resource-center/

License: Other

Shell 1.56% JavaScript 98.44%

chat-engine-server's Introduction

This repository contains the REST API running as a PubNub function that is required for the ChatEngine Framework to operate.

Documentation You can find the full docs on the documentation website.

Provisioning the ChatEngine Framework Application and Key

To set up PubNub to host the ChatEngine Framework REST API on a PubNub Function, you must first set up a new PubNub App. The following outlines how to manually set up a PubNub ChatEngine Framework Application and Key.

  1. Navigate to PubNub's Portal, sign in, and select Create New App.
  2. Enter an App name (e.g. ChatEngine Application) and click Create.
  3. Select the newly made App icon and navigate to the Demo Keyset.
  4. Update the following setting on the keyset:
Presence on
Announce Max 20
Interval 10
Presence Deltas Disabled
Generate Leave on TCP FIN or FIN Disabled
Global Here Now Enabled
Debounce 2
Callback State Change https://pubsub.pubnub.com/v1/blocks/sub-key/
__SUB_KEY__/chat-engine-server?route=user_state
Storage & Playback on
Retention 7 days
Stream Controllers on
Enable Wildcard Subscribe Enabled
PubNub Functions Enabled
Access Manager Enabled

Provisioning the ChatEngine Framework Function

Bundle the server Server Code

The REST API is composed of several files to improve understandability. The files must be bundled into a single function to upload to PubNub.

  1. Clone the chat-engine-server repo and run npm install.
  2. Run npm run build to create a bundled function at build/server.js.
  3. Run npm test to verify that the bundle is correct.
  4. Copy the code to your clipboard for later use.

Create a PubNub REST Function

  1. On your PubNub Admin Dashboard, go the ChatEngine app key you set up in the previous section to upload your Function.

  2. Select the Functions tab on the top left side of the page.

  3. Fill out the following text fields and click Create New Module:

    Field Value
    Module Name: ChatEngine Server
    Module Description: REST Function that powers PubNub ChatEngine
  4. Within the ChatEngine Module, click create and fill in the following text fields:

    Field Value
    Function Name ChatEngine Server
    Select Event Type On Request
    URI path chat-engine-server
  5. Click Create Function to navigate to the PubNub Functions Console.

  6. With the console open, copy and paste the server code from build/server.js into the console editor and click Save.

  7. Click Save at the top left side of the console editor.

  8. Click My Secrets, and enter the following, (get the secretKey from the App and Key page):

    Field Value
    Enter Key secretKey
    Enter Value __COPY_AND_PASTE_PUBNUB_SECRET_KEY__
  9. Click Save.

  10. Returning to the console, click Start Function and you are done.

Building Chat Applications with PubNub

For more information on build chat applications with PubNub, see our Chat Resource Center.

chat-engine-server's People

Contributors

messagingmoore avatar crgbaumgart avatar madisonsmith avatar samiahmedsiddiqui avatar

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.