Skip to main content

Set Up Matching Notification

Last updated on

This function sends a notification to all players that a match has been found and displays the server IP and port.

# 23. Send notification to all users
for idx, uid in enumerate(user_ids):
error = send_notif_match_found(namespace, server_ip, server_port, uid)
if error:
log_warn(f"failed to send free form notification (match found) to player ({uid}) [{(idx + 1):02d}/{len(user_ids):02d}]")
else:
log_done(f"send free form notification (match found) to player ({uid}) [{(idx + 1):02d}/{len(user_ids):02d}]")

response = {
"message": f"successfully matchmade "
f"server:(ip:{server_ip}|port:{server_port})|"
f"session:(id:{sb_session_id})|"
f"users:({user_id},{other_user_ids})",
"server": {
"ip": server_ip,
"port": server_port,
},
"session": {
"id": sb_session_id
},
"users": [
user_id,
other_user_ids
]
}