* Fix multiple chat loading bug * Open profile links in chat via new tab * Add unmount handling for chat * Add overscroll property to chat * Add channel_name to ChatChannel model * Create route and page for chatroom WIP * Expose ChatChannel id to live page * Implement multichannel support WIP * Implement chatroom page WIP * Add css for chatroom * Update chat's moderation * Refactor chat's message type * Swap the use of :message_markdown & :message_html * Add channel permissions WIP * Fix failing specs * Adjust json reponses * Add empty message prevention * Update participant error message * Change Workshop channel to General
13 lines
453 B
JavaScript
13 lines
453 B
JavaScript
import Pusher from 'pusher-js';
|
|
|
|
export default function setupPusher(key, callbackObjects) {
|
|
const pusher = new Pusher(key, {
|
|
cluster: 'us2',
|
|
encrypted: true,
|
|
});
|
|
|
|
const channel = pusher.subscribe(callbackObjects.channelId.toString());
|
|
channel.bind('message-created', callbackObjects.messageCreated);
|
|
channel.bind('channel-cleared', callbackObjects.channelCleared);
|
|
channel.bind('user-banned', callbackObjects.redactUserMessages);
|
|
}
|