46 lines
968 B
TypeScript
46 lines
968 B
TypeScript
|
import PusherJS from "pusher-js";
|
||
|
import LaravelEcho from "laravel-echo";
|
||
|
|
||
|
// import router from "./router";
|
||
|
// import { Ziggy } from "./ziggy";
|
||
|
// import Pusher from "pusher-js/types/src/core/pusher";
|
||
|
|
||
|
PusherJS.logToConsole = process.env.NODE_ENV === "development";
|
||
|
|
||
|
let echo = init();
|
||
|
|
||
|
function init() {
|
||
|
let echo = new LaravelEcho({
|
||
|
broadcaster: "pusher",
|
||
|
key: "key",
|
||
|
wsHost: "localhost",
|
||
|
wsPort: "6001",
|
||
|
// wssPort: api.ws_port,
|
||
|
forceTLS: false,
|
||
|
encrypted: true,
|
||
|
disableStats: true,
|
||
|
enableLogging: true,
|
||
|
enabledTransports: ["ws", "wss"],
|
||
|
cluster: "mt1",
|
||
|
|
||
|
authEndpoint: "/broadcasting/auth",
|
||
|
auth: {
|
||
|
headers: {
|
||
|
Accept: "application/json",
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
|
||
|
return echo
|
||
|
}
|
||
|
|
||
|
function getEcho() {
|
||
|
return echo;
|
||
|
}
|
||
|
|
||
|
function initEcho() {
|
||
|
echo.private("App.Models.User.1");
|
||
|
}
|
||
|
|
||
|
export { getEcho, initEcho };
|