Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b49e5d584 | |||
| 55aac72bd2 | |||
| b10639316e | |||
| d782832fc5 | |||
| b25cd1a039 | |||
| e269dfc208 | |||
| 066f8fbea5 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tictactoe-vite",
|
||||
"version": "v0.2.5",
|
||||
"version": "v1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -46,9 +46,16 @@ export interface NakamaContextType {
|
||||
export const NakamaContext = createContext<NakamaContextType>(null!);
|
||||
|
||||
export function NakamaProvider({ children }: { children: React.ReactNode }) {
|
||||
console.log(
|
||||
"[Nakama] Initializing...",
|
||||
// import.meta.env.VITE_WS_SKEY,
|
||||
import.meta.env.VITE_WS_HOST,
|
||||
import.meta.env.VITE_WS_PORT,
|
||||
import.meta.env.VITE_WS_SSL === "true"
|
||||
);
|
||||
const [client] = useState(
|
||||
() => new Client(
|
||||
import.meta.env.VITE_SERVER_KEY,
|
||||
import.meta.env.VITE_WS_SKEY,
|
||||
import.meta.env.VITE_WS_HOST,
|
||||
import.meta.env.VITE_WS_PORT,
|
||||
import.meta.env.VITE_WS_SSL === "true"
|
||||
@@ -117,8 +124,10 @@ export function NakamaProvider({ children }: { children: React.ReactNode }) {
|
||||
const newSession = await getSession(username);
|
||||
setSession(newSession);
|
||||
|
||||
// create a socket (new Nakama 3.x signature)
|
||||
const s = client.createSocket(undefined, undefined); // no SSL on localhost
|
||||
const s = client.createSocket(
|
||||
import.meta.env.VITE_WS_SSL === "true",
|
||||
undefined
|
||||
);
|
||||
await s.connect(newSession, true);
|
||||
setSocket(s);
|
||||
socketRef.current = s;
|
||||
|
||||
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@@ -4,6 +4,7 @@ interface ImportMetaEnv {
|
||||
readonly VITE_WS_HOST: string;
|
||||
readonly VITE_WS_PORT: string;
|
||||
readonly VITE_WS_SKEY: string;
|
||||
readonly VITE_WS_SSL: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
Reference in New Issue
Block a user