Unable to use websocket using - PHP sdk

hello team,
i am trying to use websocket market data access api. but. facing issue. please help me .

issue - Exception when calling WebsocketApi->getMarketDataFeed: [302] Redirect URI,

https://softechnology.in/getMarketDataFeed.php


https://softechnology.in/examples/websocket/market_data/websocket_client.php

Can you share the code which you are using for further assistance.

For easier implementation of websockets you can refer to streamer functionalities provided in various languages.

please check code.
https://softechnology.in/docs.zip
yes i am using same PHP SDK.
@Ketan sir . please help


when used

@ESD_Parbodh_Kumar I looked your code and noticed that you are subscribing to the WebSocket from the getMarketDataFeed.php file. This method is not correct. Please use the following code in the getMarketDataFeed.php file to subscribe to your WebSocket:

<?php


require_once(__DIR__ . '/vendor/autoload.php');

use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamer;
use Revolt\EventLoop;

function on_open($streamer)
{
    print("Connection Established");
    $streamer->subscribe(["NSE_INDEX|Nifty 50", "NSE_INDEX|Bank Nifty"], "full");
}

function on_message($streamer, $data)
{
    print($data);
}


$config = Configuration::getDefaultConfiguration()->setAccessToken(<ACESS_TOKEN>);

$streamer = new MarketDataStreamer($config);

$streamer->on("open", 'on_open');
$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();

This aligns with the example codes provided. Kindly use this.

Thank you

Hello sir,
I have updated the code. but giving 324 errors.

hello sir,
i follow steps as you mentioned . but still it giving 524 error. please

@Ketan sir please look into this. i think something is missing from my side.

? [01-Aug-2024 14:30:30 UTC] PHP Fatal error: Uncaught Error: Class “Upstox\Client\Configuration” not found