Skip to content

Add send_message_to_connection Usage Example#717

Open
ralphweng2023 wants to merge 1 commit intothoth-tech:mainfrom
ralphweng2023:udp-telemetry-hub-usage-example
Open

Add send_message_to_connection Usage Example#717
ralphweng2023 wants to merge 1 commit intothoth-tech:mainfrom
ralphweng2023:udp-telemetry-hub-usage-example

Conversation

@ralphweng2023
Copy link
Copy Markdown

Overview

This usage example demonstrates send_message_to_connection by building a "UDP Telemetry Hub" — a real-time telemetry system that sends and receives sprite position data over UDP. A simulated sprite bounces around the window, and its coordinates are formatted as POS:x,y strings and transmitted via UDP. The hub receives these packets, parses the payload, and displays live coordinates in a dashboard-style interface.

SplashKit Functions: create_server (with UDP), open_connection (with UDP), send_message_to, check_network_activity, has_messages, read_message, message_data, close_message, close_all_connections, close_all_servers

Files Included

  • Title and explanation (.txt)
  • C++ code (SplashKit)
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Screenshot/GIF

Usage Example Checks

  • Simple, clear demonstration of the function
  • Code uses SplashKit functions
  • Uses !quit_requested() (no while(true))
  • Allman-style braces (opening { on new line)
  • Identical logic and comments across all 4 code versions
  • C++ uses snake_case, C# top-level uses camelCase, C# OOP uses Namespace/Class, Python uses snake_case
  • Title file contains creative name without the word "Example"
  • Python function names verified against API docs (e.g., create_server_with_port_and_protocol, open_connection_with_protocol, send_message_to_connection, has_messages_on_connection, draw_text_no_font_no_size, refresh_screen_with_target_fps)
  • Tested in Chrome and Firefox

Integrated usage example demonstrating UDP networking in SplashKit.

Functions demonstrated:
- create_server() with UDP protocol: Set up a UDP server
- open_connection() with UDP protocol: Establish a UDP connection
- send_message_to(): Send formatted position data via UDP
- check_network_activity(): Poll for incoming packets
- has_messages() / read_message() / message_data(): Receive and parse UDP data
- close_message() / close_all_connections() / close_all_servers(): Cleanup

The example simulates a telemetry system where a sender transmits sprite
position data as 'POS:x,y' strings over UDP to a hub that displays the
live coordinates in a dashboard-style interface.

Includes all 4 code versions (C++, C# top-level, C# OOP, Python) plus
title file and GIF media.
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit af76018
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/69cbc9a711feb100081cd97a

@ekam313
Copy link
Copy Markdown

ekam313 commented Apr 3, 2026

Peer Review

I've reviewed the send_message_to_connection usage example and checked it against the usage example guide and style requirements.

Checks

  • All required files are present.
    • Example Title (.txt)
    • C++ code
    • C# code (top-level statements)
    • C# code (Object-Oriented Programming)
    • Python code
  • Code correctly uses SplashKit functions.
  • Code clearly demonstrates the function.
  • All versions maintain a consistent structure and behaviour.

Code Tests done

  • C++ code ran correctly.
  • C# top level code ran correctly.
  • C# OOP code ran correctly.
  • Python code ran correctly.

Website Tests done

  • npm run build
  • npm run preview

Review Summary

This is a strong and practical usage example that demonstrates the send_message_to_connection function in a clear and engaging way. The networking workflow is consistent across all languages, and the implementation follows the style guide requirements.

The example provides a good real-world context while still maintaining readability, making it useful for learners to understand how the function can be applied.

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants