-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d0e291
commit 25a707f
Showing
18 changed files
with
491 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export enum PRIVATE_CHANNEL { | ||
NOTIFICATION = 'private-notification', | ||
CERTIFICATE = 'certificate', // TODO: (20241009 - tzuhan) update to 'private-certificate', | ||
VOUCHER = 'private-voucher', | ||
REPORT = 'private-report', | ||
} | ||
|
||
export enum CERTIFICATE_EVENT { | ||
UPLOAD = 'certificate-upload', | ||
UPDATE = 'certificate-update', | ||
ANALYSIS = 'certificate-analysis', | ||
DELETE = 'certificate-delete', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Pusher from 'pusher'; | ||
|
||
// Info: (20241009-tzuhan) 初始化 Pusher | ||
const pusherConfig = { | ||
appId: process.env.PUSHER_APP_ID!, | ||
key: process.env.NEXT_PUBLIC_PUSHER_KEY!, | ||
secret: process.env.PUSHER_SECRET!, | ||
host: process.env.NEXT_PUBLIC_PUSHER_HOST!, | ||
useTLS: process.env.PUSHER_USE_TLS === 'true', | ||
}; | ||
|
||
let pusherInstance: Pusher | null = null; | ||
|
||
export const getPusherInstance = (): Pusher => { | ||
if (!pusherInstance) { | ||
pusherInstance = new Pusher(pusherConfig); | ||
} | ||
return pusherInstance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Pusher from 'pusher-js'; | ||
|
||
let pusherInstance: Pusher | null = null; | ||
|
||
const pusherConfig = { | ||
appKey: process.env.NEXT_PUBLIC_PUSHER_KEY!, | ||
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER || '', | ||
wsHost: process.env.NEXT_PUBLIC_PUSHER_HOST!, | ||
wsPort: parseFloat(process.env.NEXT_PUBLIC_PUSHER_PORT!), | ||
}; | ||
|
||
export const getPusherInstance = (): Pusher => { | ||
if (!pusherInstance) { | ||
pusherInstance = new Pusher(pusherConfig.appKey, { | ||
cluster: pusherConfig.cluster, | ||
wsHost: pusherConfig.wsHost, | ||
wsPort: pusherConfig.wsPort, | ||
channelAuthorization: { | ||
transport: 'jsonp', | ||
endpoint: `${pusherConfig.wsHost}/api/pusher/auth`, | ||
headers: {}, | ||
}, | ||
}); | ||
} | ||
return pusherInstance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.