Git Product home page Git Product logo

Comments (10)

jignesh87 avatar jignesh87 commented on July 30, 2024

I aso wants to perform this task.
any idea?

from phpwebsocket-chat.

manojdhiman avatar manojdhiman commented on July 30, 2024

i implemented this task but not sure it is secure or not .. :p

if you want to check then server side file is https://github.com/manojdhiman/yii-login-register-with-chat/tree/master/chat_server

and client side https://github.com/manojdhiman/yii-login-register-with-chat/blob/master/themes/basic/views/layouts/main.php

please check this is just a try if you can improve this

from phpwebsocket-chat.

jignesh87 avatar jignesh87 commented on July 30, 2024

hiii..manoj
I have created function in Server.php
function getServerData(){

$sql = "SELECT id, user_name FROM user_master";

$result = mysqli_num_rows($conn, $sql);

if ($result->num_rows(result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        $d = "id: " . $row["id"]. " - UName: " . $row["user_name"]. "<br>";die;
    }
}else{
    $d = "0 results";
}
return $d;

}
which is called when client == 1
if ( sizeof($Server->wsClients) == 1 ){
echo getServerData();
$Server->wsSend($clientID, "It's server!!");
}
when i refresh connection becomes diconnect, and it returns nothing.
Is there any prob?.

I wants to send data instead of message.
Thanks .
Jignesh

from phpwebsocket-chat.

manojdhiman avatar manojdhiman commented on July 30, 2024

it should reconnect if you refresh the page .check your terminal after refresh the page with print something on close event like

function wsOnClose($clientID, $status) {
global $Server;
$ip = long2ip( $Server->wsClients[$clientID][6] );

$Server->log( "$ip ($clientID) has disconnected." );

}

from phpwebsocket-chat.

jignesh87 avatar jignesh87 commented on July 30, 2024

Hii,Manoj
I have done server response sucessfully.
One issue is when i try sending data from server as a video file it crashes my cmd,
and it's not responding.
Is it any way to send video from server side to the client?
Thank you,
Jignesh.

from phpwebsocket-chat.

hamidteimouri avatar hamidteimouri commented on July 30, 2024

Hi,
I use websocket, but i wanna send msg to 1 person, not to all,

can u help me ?

from phpwebsocket-chat.

juanjosv avatar juanjosv commented on July 30, 2024

Hi,
I use websocket, but i wanna send msg to 1 person, not to all,
can u help me ?

And not only that, i'm trying to hide the message if anyone connect to that websocket, only show the message to the person i want

from phpwebsocket-chat.

hamidteimouri avatar hamidteimouri commented on July 30, 2024

Hi,
I use websocket, but i wanna send msg to 1 person, not to all,
can u help me ?

And not only that, i'm trying to hide the message if anyone connect to that websocket, only show the message to the person i want

This was for 2 years ago.
I fixed it !

from phpwebsocket-chat.

juanjosv avatar juanjosv commented on July 30, 2024

Hi,
I use websocket, but i wanna send msg to 1 person, not to all,
can u help me ?

And not only that, i'm trying to hide the message if anyone connect to that websocket, only show the message to the person i want

This was for 2 years ago.
I fixed it !

Oh, sorry, i found this project and using it to develop a chat system , and i'm stuck in the same case.

from phpwebsocket-chat.

hamidteimouri avatar hamidteimouri commented on July 30, 2024

Hi,
I use websocket, but i wanna send msg to 1 person, not to all,
can u help me ?

And not only that, i'm trying to hide the message if anyone connect to that websocket, only show the message to the person i want

This was for 2 years ago.
I fixed it !

Oh, sorry, i found this project and using it to develop a chat system , and i'm stuck in the same case.

You should use node js for that.
PHP socket is not good for socket programming.

from phpwebsocket-chat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.