Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ably-chat-component

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ably-chat-component - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

6

api/createTokenRequest/package-lock.json

@@ -381,5 +381,5 @@ {

"ws": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
"integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
"requires": {

@@ -386,0 +386,0 @@ "async-limiter": "~1.0.0"

@@ -29,3 +29,6 @@ import AblyBaseComponent from "./AblyBaseComponent";

super.connectedCallback();
super.subscribe('chat', 'chat-message', (message) => {
const subscribeChannelAttr = this.getAttribute("data-subscribe-channel");
const subscribeChannel = subscribeChannelAttr ? subscribeChannelAttr : 'chat';
super.subscribe(subscribeChannel, 'chat-message', (message) => {
this.onAblyMessageReceived(message);

@@ -66,3 +69,3 @@ });

onAblyMessageReceived(message) {
onAblyMessageReceived(message) {
const history = this.messages.slice(-199);

@@ -74,3 +77,5 @@ const updatedMessages = [...history, message];

sendChatMessage(messageText) {
super.publish("chat", { name: "chat-message", data: messageText });
const publishChannelAttr = this.getAttribute("data-publish-channel");
const publishChannel = publishChannelAttr ? publishChannelAttr : 'chat';
super.publish(publishChannel, { name: "chat-message", data: messageText });
this.inputBox.value = "";

@@ -77,0 +82,0 @@ this.inputBox.focus();

@@ -29,3 +29,6 @@ import AblyBaseComponent from "./AblyBaseComponent.js";

super.connectedCallback();
super.subscribe('chat', 'chat-message', (message) => {
const subscribeChannelAttr = this.getAttribute("data-subscribe-channel");
const subscribeChannel = subscribeChannelAttr ? subscribeChannelAttr : 'chat';
super.subscribe(subscribeChannel, 'chat-message', (message) => {
this.onAblyMessageReceived(message);

@@ -66,3 +69,3 @@ });

onAblyMessageReceived(message) {
onAblyMessageReceived(message) {
const history = this.messages.slice(-199);

@@ -74,3 +77,5 @@ const updatedMessages = [...history, message];

sendChatMessage(messageText) {
super.publish("chat", { name: "chat-message", data: messageText });
const publishChannelAttr = this.getAttribute("data-publish-channel");
const publishChannel = publishChannelAttr ? publishChannelAttr : 'chat';
super.publish(publishChannel, { name: "chat-message", data: messageText });
this.inputBox.value = "";

@@ -77,0 +82,0 @@ this.inputBox.focus();

{
"name": "ably-chat-component",
"version": "1.0.7",
"version": "1.0.8",
"description": "Real time chat from Ably - just add your own API key!",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -42,2 +42,4 @@ # README

### Authentication
While you're developing or testing, you can set your API key using `data-api-key`.

@@ -64,2 +66,14 @@

### Specifying channel names
You can specify which channels to use for publishing and for subscribing:
```html
<ably-chat data-publish-channel="chat" data-subscribe-channel="chat"></ably-chat>
```
If either of these are not specified, it will default to `chat`. Usually you will want both the publish and subscribe channels to be the same, to enable clients to talk directly to one another. In some scenarios you may want to have some form of processing occur on the message before being sent to other clients.
An example of this would be having a server perform filtering on messages before making them available to other clients. You could publish the messages to `chat-output`, which the server is subscribed to. The server could filter out any banned words, and then send a message to `chat-input` for all the other clients to then see the result.
## Setting up token authentication

@@ -66,0 +80,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc