Read the full tutorial here:
>> Build a modern Android chat app with Kotlin
This example shows how to build an anonymous group chat with Kotlin:
| import React, { Component } from 'react' | |
| import { ChatManager, TokenProvider } from '@pusher/chatkit' | |
| import MessageList from './MessageList' | |
| import SendMessageForm from './SendMessageForm' | |
| +import OnlineList from './OnlineList' | |
| class Chat extends React.Component { | |
| state = { | |
| currentUser: null, |
| // Install-Package jose-rt | |
| using System; | |
| using System.Text; | |
| using System.Collections.Generic; | |
| using Jose; | |
| public class Program | |
| { | |
| public static void Main() |
| error_log logs/error.log; | |
| events { | |
| worker_connections 1024; | |
| } | |
| rtmp { | |
| server { | |
| listen 1935; | |
| chunk_size 4000; |
| set -as terminal-overrides ",*-256color:Tc" | |
| set -g prefix C-Space | |
| set-window-option -g mode-keys vi | |
| bind-key , command-prompt "rename-window '%%'" | |
| set -g status-right '#H %a %d %H:%M #{prefix_highlight}' | |
| set -g @plugin 'tmux-plugins/tpm' | |
| set -g @plugin 'tmux-plugins/tmux-sensible' | |
| set -g @plugin 'tmux-plugins/tmux-pain-control' | |
| set -g @plugin 'tmux-plugins/tmux-yank' | |
| set -g @plugin 'tmux-plugins/tmux-prefix-highlight' |
Read the full tutorial here:
>> Build a modern Android chat app with Kotlin
This example shows how to build an anonymous group chat with Kotlin:
| class Chat extends Component { | |
| constructor() { | |
| this.state = { | |
| messages: [] | |
| } | |
| } | |
| async onComponentDidMount() { | |
| await CometChat.init(process.env.appId) | |
| this.user = await CometChat.login("bendewberry") |
| await CometChat.init(process.env.COMETCHAT_APP_ID) | |
| const user = await CometChat.login("bendewberry") | |
| // Send message to "#General" group | |
| const message = new CometChat.TextMessage( | |
| "#General", | |
| "Hello everyone", | |
| CometChat.MESSAGE_TYPE.TEXT, | |
| CometChat.RECEIVER_TYPE.GROUP) | |
| await CometChat.sendMessage(message) |
| CometChat.init(this, "APP_ID", new CometChat.CallbackListener<String>() { | |
| @Override | |
| public void onSuccess(String successMessage) { | |
| Log.d(TAG, "Initialization completed successfully"); | |
| } | |
| }); | |
| TextMessage textMessage = new TextMessage( | |
| "#General", | |
| "Hi everyone", |
| CometChat.init(this, "APP_ID", object : CometChat.CallbackListener<String>() { | |
| override fun onSuccess(p0: String?) { | |
| Log.d(TAG, "Initialization completed successfully") | |
| } | |
| }) | |
| CometChat.login("bendewberry", object : CometChat.CallbackListener<User>() { | |
| override fun onSuccess(p0: User?) { | |
| Log.d(TAG, "Login Successful : " + p0?.toString()) | |
| } |
| CometChat.login(UID: "bendewberry", apiKey: "API_KEY", onSuccess: { (user) in | |
| print("Login successful : " + user.stringValue()) | |
| }) | |
| let textMessage = TextMessage( | |
| receiverUid: "#General", | |
| text: "Hi everyone", | |
| messageType: .text, | |
| receiverType: .group) |