Skip to content

piehostHQ/php-ws-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket PHP Client Example

This project demonstrates how to use connect to a WebSocket server from PHP active as a client.


Features

  • Connects to a PieSocket WebSocket channel.
  • Sends a message to the server.
  • Receives and displays the server's response.

Prerequisites

Before you start, ensure you have the following:

  1. PHP 7.4+ installed.
  2. Composer installed for dependency management.
  3. A valid PieSocket account to get your API key, cluster ID, and channel ID.

Installation

  1. Clone the repository:
    git clone https://github.com/piehostHQ/php-ws-client.git
    cd piesocket-php-client-example
    

Install dependencies using Composer:

composer install

Usage Replace the placeholders in the script (index.php) with your PieSocket credentials:

$channelId = "your-channel-id";
$clusterId = "your-cluster-id";
$apiKey = "your-api-key";

Run the script:

php webSocketClient.php

Observe the server's response in the console.

Example Output

Response from server: Hello from PieSocket!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages