Skip to content

Instantly share code, notes, and snippets.

return (
<div className="channel-wrap">
<div className="channel-list">
<ChannelList
onChannelSelect={(channel) => {
setChannel(channel);
}}
/>
</div>
<div className="channel-chat">
function App() {
const APP_ID = process.env.REACT_APP_APP_ID;
const USER_ID = process.env.REACT_APP_USER_ID;
const NICKNAME = process.env.REACT_APP_NICKNAME;
const ACCESS_TOKEN = process.env.REACT_APP_ACCESS_TOKEN;
const sb = SendbirdChat.init({
appId: APP_ID,
modules: [new GroupChannelModule()],
});
@sendbird-community
sendbird-community / enter_room_as_invitee.swift
Created April 11, 2023 06:46
Enter the room as invitee
func didReceiveInvitation(_ invitation: RoomInvitation) { // Received invitation
invitation.accept { _in // Accepted invitation
invitation.room.enter { error in
// The user has entered the room.
}
}
}
@sendbird-community
sendbird-community / receive_delegate_events_about_response.swift
Created April 11, 2023 06:45
Receive delegate events about callee response
class MyClass: RoomDelegate {
func wasInvitationAccepted(_ invitation: RoomInvitation) {
// Invitation was accepted by `invitation.invitee`
}
func wasInvitationDeclined(_ invitation: RoomInvitation) {
// Invitation was declined by `invitation.invitee`
}
}
@sendbird-community
sendbird-community / accept_or_decline_invitation.swift
Last active April 11, 2023 06:44
Accept or decline the invitation
func didReceiveInvitation(_ invitation: RoomInvitation) {
// Accept an invitation.
invitation.accept { error in
// Invitation was accepted with error: \(error)
}
// Decline an invitation.
invitation.decline { error in
// Invitation was accepted with error: \(error)
}
class AppDelegate: UIResponder, UIApplicationDelegate, SendBirdCallDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let applicationId: String = <#YOUR_APPLICATION_ID#>
SendBirdCall.configure(appId: applicationId)
SendBirdCall.addDelegate(self, identifier: String(describing: Self.self))
...
return true
@sendbird-community
sendbird-community / pass_received_push_notification.swift
Created April 11, 2023 06:41
Pass on received push notification
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
SendBirdCall.application(application, didReceiveRemoteNotification: userInfo)
}
}
room.sendInvitation(invitee: inviteeId) { invitation, error in
guard error == nil else { return }
// Invitation has been successfully sent to the invitee.
}
room.enter { error in
// user has entered the room.
}
let roomType = RoomType.smallRoomForVideo
let params = RoomParams(roomType: roomType)
SendBirdCall.createRoom(with: params) { room, error in
guard let room = room, error == nil else { return } // Handle error.
// `room` is created with a unique identifier `room.roomId`.
}