emit socket events on game start/join
This commit is contained in:
		
							parent
							
								
									a5bba9d3a4
								
							
						
					
					
						commit
						fc059670f4
					
				| @ -1,6 +1,6 @@ | ||||
| import flask | ||||
| 
 | ||||
| import truthseeker | ||||
| from truthseeker import APP | ||||
| from truthseeker.logic import game_logic | ||||
| from truthseeker.utils import check_username | ||||
| 
 | ||||
| @ -46,6 +46,8 @@ def join_game(): | ||||
|     flask.session["is_owner"] = False | ||||
|     flask.session["username"] = username | ||||
| 
 | ||||
|     APP.socketio_app.emit("playersjoin", [flask.session["username"]], room="game."+game.game_id) | ||||
| 
 | ||||
|     return {"error": 0} | ||||
|      | ||||
| @routes_api.route("/startGame", methods=["GET", "POST"]) | ||||
| @ -65,6 +67,7 @@ def start_game(): | ||||
| 
 | ||||
|     game.has_started = True | ||||
| 
 | ||||
|     APP.socketio_app.emit("gamestart", {}, room="game."+game.game_id) | ||||
|      | ||||
|      | ||||
|     return {"error": 0} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user