Skip to content

Commit

Permalink
db work
Browse files Browse the repository at this point in the history
  • Loading branch information
cubap committed Oct 15, 2024
1 parent cbc40ac commit 3fe57f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MONGO_URI=mongodb://localhost:27017
MONGO_URI=mongodb://localhost:27017/trade
PORT=5000
10 changes: 8 additions & 2 deletions client.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import 'dotenv/config'
import { io } from 'socket.io-client'
import mongoose from 'mongoose'

const socket = io('http://localhost:5000')

// Use a valid ObjectId
const validObjectId = process.env.TEST_PAWN
// const validObjectId = new mongoose.Types.ObjectId().toString()

socket.on('connect', () => {
console.log('Connected to server')

// Example player action
socket.emit('playerAction', { entityId: 'exampleEntityId', newPosition: { x: 10, y: 20 } })
// Example player action with a valid ObjectId
socket.emit('playerAction', { entityId: validObjectId, newPosition: { x: 10, y: 20 } })

// Listen for game state updates
socket.on('gameState', (state) => {
Expand Down

0 comments on commit 3fe57f6

Please sign in to comment.