{"id":19768498,"url":"https://github.com/radeeyate/playlink","last_synced_at":"2025-10-14T04:12:19.290Z","repository":{"id":228266231,"uuid":"773527787","full_name":"radeeyate/PlayLink","owner":"radeeyate","description":"Make HTTP(S) requests from your Playdate console!","archived":false,"fork":false,"pushed_at":"2024-03-18T22:49:06.000Z","size":12,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T11:02:03.605Z","etag":null,"topics":["http","http-client","http-requests","https","https-client","playdate","playdate-console","playdate-sdk","serial","serial-communication","serialport"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radeeyate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-17T22:24:56.000Z","updated_at":"2025-04-17T09:09:46.000Z","dependencies_parsed_at":"2024-03-18T23:49:09.895Z","dependency_job_id":null,"html_url":"https://github.com/radeeyate/PlayLink","commit_stats":null,"previous_names":["radeeyate/playlink"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/radeeyate/PlayLink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeeyate%2FPlayLink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeeyate%2FPlayLink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeeyate%2FPlayLink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeeyate%2FPlayLink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radeeyate","download_url":"https://codeload.github.com/radeeyate/PlayLink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeeyate%2FPlayLink/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017981,"owners_count":26086212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-client","http-requests","https","https-client","playdate","playdate-console","playdate-sdk","serial","serial-communication","serialport"],"created_at":"2024-11-12T04:38:41.046Z","updated_at":"2025-10-14T04:12:19.284Z","avatar_url":"https://github.com/radeeyate.png","language":"Lua","readme":"# PlayLink\n\n\u003e [!IMPORTANT]  \n\u003e Panic released an update to the Playdate SDK that allows you to natively make HTTP requests or use TCP directly. Please check that out instead: https://sdk.play.date/2.7.6/Inside%20Playdate.html#M-network\n\nPlayLink is a protocol for the Playdate console that allows you to make arbitrary HTTP(S) requests.\nIt uses the Playdate serial interface to interact with the \"server\" running on a computer.\n\n## Running the server\n\n1. Clone the repository:\n\n    Begin by cloning the PlayLink repository using Git:\n\n    ```bash\n    git clone https://github.com/radeeyate/PlayLink.git\n    ```\n\n2. **Install Go:**\n\n   PlayLink's server component is written in Go. To proceed, you'll need Go installed on your system. You can download and install Go from the official website: [https://go.dev/doc/install](https://go.dev/doc/install)\n\n3. **Build the Server:**\n\n   Navigate to the PlayLink server directory:\n\n   ```bash\n   cd PlayLink/server\n   ```\n\n   Then, build the server executable using the following commands:\n\n   ```bash\n   go get\n   go build\n   ```\n\n   This will generate a binary file. The filename will vary depending on your operating system:\n\n   - **Windows:** PlayLink.exe (not officially tested yet)\n   - **Linux:** PlayLink\n\n   On Linux, grant executable permissions to the server file using chmod:\n\n   ```bash\n   chmod +x ./PlayLink\n   ```\n\n4. **Run the Server:**\n\n   Execute the server using the following command:\n\n   ```bash\n   ./PlayLink\n   ```\n\n## Using the Lua Client\n\nTo leverage PlayLink's functionalities within your Playdate project, follow these steps:\n\n1. **Copy Lua Files:**\n\n   Copy the `b64.lua` and `playlink.lua` files from the PlayLink repository into your Playdate project's directory.\n\n2. **Import Library:**\n\n   Within your Playdate Lua code, include the PlayLink library using the following statement:\n\n   ```lua\n   local playlink = import \"playlink\"\n   ```\n\n3. **Initialize Library:**\n\n   PlayLink requires initialization before you can use its functions. Call the following code snippet to initialize the library:\n\n   ```lua\n   playlink.init()\n   ```\n\n   Currently, there are no error messages if the initialization fails. However, subsequent PlayLink functions will not work without successful initialization.\n\n4. **Serial Message Processing:**\n\n   To enable PlayLink to recognize serial messages from the Playdate, incorporate the following code into your project:\n\n   ```lua\n   function playdate.serialMessageReceived(message)\n       playlink.process(message)\n   end\n\n   function playlink.onResponse(response)\n       -- Do something with the response body here\n   end\n   ```\n\n   This code establishes a callback function that executes whenever the Playdate receives a serial message. The `playlink.process` function handles the message and calls the `playlink.onResponse` function once the request is complete. The `response` parameter within `playlink.onResponse` holds the response data from the server.\n\n   **Understanding the Response Data**\n\n   The `playlink.onResponse` function you defined earlier receives a Lua table containing information about the server's response to your request. This table has three key components:\n\n   1. **body (string):** This field holds the actual response data retrieved from the server. It's typically the content you requested, often formatted in JSON.\n\n   2. **status_code (number):** This field indicates the HTTP status code returned by the server. Common status codes include:\n      - 200: OK (Success)\n      - 404: Not Found (The requested resource was not found)\n      - 500: Internal Server Error (An unexpected error occurred on the server)\n\n      By checking the `status_code`, you can determine if the request was successful and tailor your game's behavior accordingly.\n\n   3. **identifier (string, optional):** If you provided a unique identifier when making the request using `playlink.get(\"url\", identifier)`, it will be included in this field. This identifier can be helpful for correlating responses with specific requests.\n\n5. **Make a GET Request**\n\n   Once you've completed the setup steps, you can start making HTTP GET requests to retrieve data from a server. Here's how:\n\n   ```lua\n   playlink.get(\"https://www.example.com/api/data\", \"examplerequest\")  -- Replace with the actual URL\n\n   -- The callback function (playlink.onResponse) will be called with the response body\n   -- upon successful completion of the request.\n   ```\n\n   The `playlink.get` function takes the target URL (including protocol) as a string argument. Remember to replace `\"https://www.example.com/api/data\"` with the actual URL you want to fetch data from. You can also pass another argument to identify your requests from other ones. If you don't want to add one, just pass `nil`.\n\n   Upon successful retrieval of data from the server, `playlink.onResponse` will be invoked with the response body containing the fetched data. You can then parse and utilize the data within your Playdate game or app.\n\n**Note:** Presently, PlayLink only returns JSON responses. Support for other response formats will be added in future updates.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradeeyate%2Fplaylink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradeeyate%2Fplaylink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradeeyate%2Fplaylink/lists"}