Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I run this application #118

Open
areaboy opened this issue May 8, 2019 · 22 comments
Open

How do I run this application #118

areaboy opened this issue May 8, 2019 · 22 comments

Comments

@areaboy
Copy link

areaboy commented May 8, 2019

Hi everyone. I just downloaded this amazing application. please how do I run it or how do I start the server. do I need to install composer or anything. I just run the client.html in two browser but no realtime chat. Am new to this. Please help. Thanks

@ghedipunk
Copy link
Owner

ghedipunk commented May 8, 2019 via email

@areaboy
Copy link
Author

areaboy commented May 8, 2019

Hello Sir. I have tried as you sugessted. At testwebsock.php, i change port no to
$echo = new echoServer("127.0.0.1","9000");

then at client line 20 i set have
var host = "ws://127.0.0.1:9000"; // SET THIS TO YOUR SERVER

when I cd into the root directory and type testwebsock.php from the command prompt and run the chat app, the two broswer are not communicating via chat

I have also tried
$echo = new echoServer("127.0.0.1","9000/echobot");
I cannot get it to work Sir. Please can you help me further. Thanks

@ghedipunk
Copy link
Owner

ghedipunk commented May 8, 2019 via email

@areaboy
Copy link
Author

areaboy commented May 8, 2019

Now I leave it at $echo = new echoServer("0.0.0.0","9000");

If type testwebsock.php at command prompt, it will just open the the testwebsock.php script

if run php testwebsock.php at command prompt. it will display error in the screenshot below

screenshot

I think the issue is the right command for starting the server. Am running php version 7.2.10

@ghedipunk
Copy link
Owner

ghedipunk commented May 8, 2019 via email

@areaboy
Copy link
Author

areaboy commented May 8, 2019

I have added the line of code but it shows another error in the screenshot below
screenshot

@ghedipunk
Copy link
Owner

ghedipunk commented May 8, 2019 via email

@areaboy
Copy link
Author

areaboy commented May 8, 2019

I have uncomment it in the php.ini and restart apache and the server gets started as can be seen in the screenshot below
screenshot

Now when I run client.html am having the error below which is now caused by user.php
screen 2

@areaboy
Copy link
Author

areaboy commented May 9, 2019

please Sir, any further help

@dan-english
Copy link

websockets.php change

$user = new $this->userClass(uniqid('u'), $socket);

to

$user = new $this->userClass(uniqid('u'), $socket, 1048576);

testwebsock.php change

$echo = new echoServer("0.0.0.0","9000");

to

$echo = new echoServer("0.0.0.0","9000", 1048576);

and enable the sockets extension in php.ini should be enough to get you up and running (I'd make a PR but lacking perms)

@ghedipunk
Copy link
Owner

ghedipunk commented May 9, 2019 via email

@dan-english
Copy link

Couldn't push a branch up to create a PR off...regardless that should be enough to get @areaboy up and running.

@areaboy
Copy link
Author

areaboy commented May 10, 2019

Thanks for helping me so far.
I have added all the codes as suggested by Sir dan-english. Now the app successfully runs without error.
But there a new issue. when I chat by opening two browser pointing to the same url**(mozila and chrome)**.
If am chating from one browser(Chrome), its not reflecting in the other(firefox) and vice versa.

I discovered that both sent message and Recieved message are appearing on the same senders chatbox.

here is the screenshot
screenshot

here is the link to the chat files at google drive link

Between. Thanks

@areaboy
Copy link
Author

areaboy commented May 10, 2019

@dan-english and @ghedipunk please any more help on the issues above.

@areaboy
Copy link
Author

areaboy commented May 11, 2019

Its working now. It can chat will all connected users now. Thanks alot at Sir Dan-English and at Sir ghedipunk

@davidbarra
Copy link

And which was the solution for this issue?

If am chating from one browser(Chrome), its not reflecting in the other(firefox) and vice versa.

I discovered that both sent message and Recieved message are appearing on the same senders chatbox.

@lucaslucasnet
Copy link

lucaslucasnet commented Oct 25, 2019

Hi, im having same problem as @davidbarra:

"If am chating from one browser(Chrome), its not reflecting in the other(firefox) and vice versa.

I discovered that both sent message and Recieved message are appearing on the same senders chatbox.
"
can someone post the solution?

Thanks!!!

@ghedipunk
Copy link
Owner

ghedipunk commented Oct 25, 2019 via email

@lucaslucasnet
Copy link

An echo server is not a chat server. An echo server is just a proof of concept, for developers to use to build off of for their own applications. Its one and only function is to repeat exactly what it received, to prove that the connection works.

On Fri, Oct 25, 2019 at 1:36 PM Lucas Lucas @.***> wrote: Hi, im having same problem as @davidbarra https://github.com/davidbarra: — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#118?email_source=notifications&email_token=AAB46PRBCLX4ABLMP2BV43TQQNKEHA5CNFSM4HLUIMGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECJP3DQ#issuecomment-546504078>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB46PVBYJLGGNQNMXC64XLQQNKEHANCNFSM4HLUIMGA .

Thanks!!

@lucaslucasnet
Copy link

lucaslucasnet commented Oct 25, 2019

An echo server is not a chat server. An echo server is just a proof of concept, for developers to use to build off of for their own applications. Its one and only function is to repeat exactly what it received, to prove that the connection works.

On Fri, Oct 25, 2019 at 1:36 PM Lucas Lucas @.***> wrote: Hi, im having same problem as @davidbarra https://github.com/davidbarra: — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#118?email_source=notifications&email_token=AAB46PRBCLX4ABLMP2BV43TQQNKEHA5CNFSM4HLUIMGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECJP3DQ#issuecomment-546504078>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB46PVBYJLGGNQNMXC64XLQQNKEHANCNFSM4HLUIMGA .

I found the solution and it was very simple, I don't want to be thankful but it wasn't easier for both of us to tell me this answer?
I know that it is on my own to search in advance, but hey

protected function process ($from, $message) { // changed $user to $from, just to avoid confusion
	foreach ($this->users as $user){ // sending to all connected users
		if($from !== $user){ // avoid to send msg to sender
			$this->send($user, $message);
		}
	}
  }

@ghost
Copy link

ghost commented Aug 6, 2021

image
Hi, I'm having this problem when I run the application, can you help me? pls

@ghedipunk
Copy link
Owner

ghedipunk commented Aug 6, 2021 via email

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

No branches or pull requests

5 participants