We're using Pusher/channel to push a message from server to client. For instance:
When a user type a new comment, the other user will receive this comment immediately.
Or when a new user was added to a new project, he/she will be see it right after the manager update member list
To use it, in your backend code, import the pusherTrigger
and trigger an event as follows:
import { pusherTrigger } from '../../lib/pusher-server'
const eventName = `event-delete-task-comment`
pusherTrigger ( 'team-collab' , eventName , {
id,
triggerBy : updatedBy
} )
Next, on the client side, create a new file in format as follow ui-app/app/_events/useEvent<event-name>.ts
// ui-app/app/_events/useEventDeleteComment.ts
import { usePusher } from './usePusher' // search usePusher in /ui-app
export const useEventDeleteComment = ( ) => {
useEffect ( ( ) => {
const eventName = `event-delete-task-comment`
channelTeamCollab &&
channelTeamCollab . bind ( eventName , ( data ) => {
console . log ( data )
} )
return ( ) => {
channelTeamCollab && channelTeamCollab . unbind ( eventName )
}
} , [ channelTeamCollab ] )
}
Configure environment variables
Configure Email notification and Storage
Configure Push notification using Pusher.js
Name
Value
Desc
Required
NEXT_PUBLIC_PUSHER_INSTANCE_ID
Pusher beam instance id
PUSHER_INSTANCE_ID
Pusher beam instance id
PUSHER_SECRET_KEY
Pusher beam secret key
NEXT_PUBLIC_PUSHER_CHANNEL_APP_KEY
Push channel app key
NEXT_PUBLIC_PUSHER_CHANNEL_APP_CLUSTER
ap1
Pusher channel app cluster
PUSHER_CHANNEL_APP_ID
1710577
Pusher channel app id
PUSHER_CHANNEL_SECRET
Pusher channel secret
Configure Livekit for online meeting
Name
Value
Desc
Required
LIVEKIT_API_KEY
ANSWjslSNAwexMy
Livekit api key
LIVEKIT_API_SECRET
Livekit api secret
NEXT_PUBLIC_LIVEKIT_URL
wss://namviek-hmunmehy.livekit.cloud
Livekit url
Name
Value
Desc
Required
LOGTAIL_SOURCE_TOKEN
Logtail source token
Configure firebase for email verification
Name
Value
Desc
Required
FIREBASE_PROJECT_ID
namviek-4234
Project id
FIREBASE_CLIENT_EMAIL
[email protected]
Client email generated by Firebase
FIREBASE_PRIVATE_KEY
Firebase private key