
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
A robust JavaScript library to connect to Kick.com's chat, designed to work seamlessly in both Node.js and browser environments.
npm i kichat.js
import { KickChat } from 'kichat.js';
const client = new KickChat();
client.on('connected', () => {
console.log('Successfully connected to Kick!');
// Join a channel after connecting
client.join('xqc');
});
client.on('join', (channel) => {
console.log(`Joined channel: ${channel.slug}`)
});
client.on('message', (message, channel) => {
console.log(`[${channel.slug}] ${message.sender.username}: ${message.content}`);
});
// Start the connection
client.connect();
The library is available on the window
object as kickChat
.
<script src="https://cdn.jsdelivr.net/npm/kichat.js/dist/kichat.js.browser-global.min.js"></script>
<script>
const client = new kichat.KiChatjs()
client.on('connected', () => console.log('Connected!'));
client.on('join', (data) => console.log(`Successfully joined channel: ${data.info.slug}`))
client.connect();
client.join('xqc');
</script>
new KickChat(options)
Creates a new client instance.
Options:
channels
(string[], optional): An array of channel slugs to automatically join upon connection.reconnect
(boolean, optional, default: true
): Whether the client should attempt to reconnect automatically if the connection is lost.reconnectMaxAttempts
(number, optional, default: Infinity
): Maximum number of reconnection attempts.reconnectInitialTimeout
(number, optional, default: 1000
): The initial time to wait in milliseconds before the first reconnection attempt.reconnectMaxTimeout
(number, optional, default: 60000
): The maximum time to wait in milliseconds between reconnection attempts.subscribePusher
({ channel: boolean, chatRoom: boolean, predictions: boolean }, optional, default: true
): With this you can choose which events you want to connect in the pusher, if you only want chat messages you can enable only the chatRoom.connect()
: Establishes the connection to Kick's WebSocket server. This must be called to start receiving events.
.close()
: Cleanly disconnects the client.
.isConnected()
: Checks if the websocket is connected.
.join(channelName)
: Asynchronously joins a chat channel. Returns a Promise
which resolves with the Channel
object upon successful join confirmation from the server.
channelName
(string): The slug of the channel to join (e.g., 'xqc')..leave(channelName)
: Leaves a chat channel.
channelName
(string): The slug of the channel to leave from..fetchUserInfo(channelName)
: Get user data from api.
channelName
(string): The slug of the channel to fetch..fetchChatRoom(channelName)
: Get chat room data from api.
channelName
(string): The slug of the channel to fetch.Listen to events using client.on('eventName', (arg1, arg2, ...) => { ... });
connected
: Fired when the WebSocket connection is successfully established.disconnected
(reason: string)
: Fired when the client is disconnected.reconnecting
: Fired when the client is attempting to reconnect after an unexpected disconnection.join
(channel: Channel)
: Fired when the client successfully subscribes to a channel's events.leave
(channel: Channel)
: Fired when the client leaves a channel.error
(error: Error)
: Fired when an error occurs.All channel-specific events return the Channel
object as the last parameter, which contains rich data about the channel and its chatroom settings.
message
(message: MessageData, channel: Channel)
: A standard chat message was sent.subscription
(subscription: Subscription, channel: Channel)
: A user subscribed to the channel.giftedSubscriptions
(event: GiftedSubscriptionsEvent, channel: Channel)
: One or more gift subscriptions were sent in chat.streamHost
(event: StreamHostEvent, channel: Channel)
: The channel started hosting another channel.userBanned
(event: UserBannedEvent, channel: Channel)
: A user was banned from the chatroom.userUnbanned
(event: UserUnbannedEvent, channel: Channel)
: A user was unbanned.messageDeleted
(event: MessageDeletedEvent, channel: Channel)
: A single message was deleted.pinnedMessageCreated
(event: PinnedMessageCreatedEvent, channel: Channel)
: A message was pinned.pinnedMessageDeleted
(event: MessageDeletedEvent, channel: Channel)
: A pinned message was removed.chatroomUpdated
(event: ChatroomUpdatedEvent, channel: Channel)
: Chatroom settings (e.g., slow mode) were updated.pollUpdate
(event: PollUpdateEvent, channel: Channel)
: A poll was created or updated.pollDelete
(channel: Channel)
: A poll was deleted.streamerIsLive
(event: StreamerIsLiveEvent, channel: Channel)
: The streamer started a live broadcast.stopStreamBroadcast
(event: StopStreamBroadcastEvent, channel: Channel)
: The live broadcast has ended.goalCreated
(event: GoalEvent, channel: Channel)
: A new follower/sub goal was created.goalCanceled
(event: GoalEvent, channel: Channel)
: A goal was canceled.goalProgressUpdate
(event: GoalEvent, channel: Channel)
: A goal's progress was updated.livestreamUpdated
(event: LivestreamUpdatedEvent, channel: Channel)
: Livestream info (title, category) was updated.predictionCreated
(event: PredictionEvent, channel: Channel)
: A new prediction was started.predictionUpdated
(event: PredictionEvent, channel: Channel)
: A prediction was updated (locked, resolved, etc.).rewardRedeemed
(event: RewardRedeemedEvent, channel: Channel)
: A viewer redeemed a channel point reward.luckyUsersWhoGotGiftSubscriptions
(event: LuckyUsersWhoGotGiftSubscriptionsEvent, channel: Channel)
: A list of users who received gifted subscriptions.giftsLeaderboardUpdated
(event: GiftsLeaderboardUpdatedEvent, channel: Channel)
: The gift leaderboard was updated.If you wish to build the library from the source code, clone the repository and run the following commands:
git clone https://github.com/zaacksb/kickChat-gemini.git
cd kickChat-gemini
npm install
npm run build
Contributions are welcome! Please feel free to open an issue to discuss what you would like to change or submit a Pull Request.
Here are some features and improvements planned for the future:
.say(channel, message)
method to send messages to a chatroom. This will likely require handling user authentication..ban()
, .unban()
, .timeout()
, and .deleteMessage()
.FAQs
A JavaScript library to connect to Kick.com chat.
The npm package kichat.js receives a total of 13 weekly downloads. As such, kichat.js popularity was classified as not popular.
We found that kichat.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.