pubnub / chat-engine-uploadcare

Easily add image uploads to chatrooms using UploadCare online service.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uploadcare Plugin for Chat Engine

Adds the ability to upload images in a ChatEngine Chat via UploadCare service

Check out the UploadCare Setup Instructions

Quick Start

  1. Have a ChatEngine server running already, instantiate a client and connect it
const ChatEngine = ChatEngineCore.create({
    publishKey: 'pub-key-here',
    subscribeKey: 'sub-key-here'
});

ChatEngine.connect('Username');
ChatEngine.on('$.ready', () => { ... });
  1. Attach this plugin to the channel you want, in this case global
ChatEngine.global.plugin(ChatEngineCore.plugin['chat-engine-uploadcare']());
  1. Bind UploadCare to a UI element
const widget = uploadcare.Widget('[role=uploadcare-uploader]');
ChatEngine.global.uploadcare.bind(widget);
  1. Listen for the $uploadcare.upload events on your channel
ChatEngine.global.on('$uploadcare.upload', (payload) => {
    console.log(payload.data.cdnUrl);
});

Support

  • If you need help, have a general question a feature request or to file a bug, contact support@pubnub.com

About

Easily add image uploads to chatrooms using UploadCare online service.

https://www.pubnub.com/developers/chat-resource-center/

License:Other


Languages

Language:JavaScript 73.7%Language:HTML 26.3%