Closed GoogleCodeExporter closed 9 years ago
To be honest, I don't know anything about Glassfish or Grizzly. Does it contain
a WebSocket server?
Currently the phpws client is only tested with the phpws server. The error
suggests that the client closed the connection unexpectedly. Does the exception
occur after a $client->close() ?
The close method currently does not anything more than closing the socket,
actually it should sent a CLOSE frame to the server and wait for a CLOSE frame
of the server. I will implement this during the weekend.
Original comment by ch...@devristo.com
on 30 Nov 2011 at 5:48
Thanks for your reply. We have tried with different send methods (you can see
in the sample code). But the server doesn't get any messages. The exception in
glassfish we were getting because $client->readMessage() was returning null and
$msg->getData() was causing unexcepted exit from the code and didn't reach the
$client->close();
<?php
require_once("websocket.client.php");
$input = "Hello World!";
$msg = WebSocketMessage::create($input);
// $msg = WebSocketMessage76::create($input);
$client = new WebSocket("ws://localhost:8080/my/websocket");
$client->open();
$client->sendMessage($msg);
// $client->send($input);
// Wait for an incoming message
$error_counter = 5;
while ($error_counter) {
try {
$msg = $client->readMessage();
echo "response: ...";
if ( $msg != NULL) {
echo $msg->getData(); // Prints "Hello World!" when using the demo.php server
$error_counter --;
}
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
}
$client->close();
?>
With best regards
Original comment by mamta.hi...@googlemail.com
on 1 Dec 2011 at 12:39
It seems like a protocol issue, does your websocket server support the
Websocket Hybi protocol version/draft ?
The phpws client only supports the Hybi version.
Original comment by ch...@devristo.com
on 1 Dec 2011 at 4:49
We modified your code so that it can also support the hixie protocol. You can
find the changes in the attached files. The connection is perfect and the send
method functions too.
Hello,
Our websocket server on glassfish 3.1.1 supports also Hybi protocol, but for
that something is still missing and we cannot able to build the connection. The
php client caused the server to call onClose event for unknown reason. We'd
prefer to use Hybi due to binary data transfer functionality.
The change you made regarding building a socket using stream_socket_client()
instead of socket_create() is very wellcome because now the php_socket module
is not needed and it makes able to use this client on more platforms where
there is no such available module.
Regards
Original comment by mamta.hi...@googlemail.com
on 15 Dec 2011 at 11:18
Attachments:
Weird stuff, so HIXIE works but HYBI does not?
Is glassfish easy to setup? If it is I might have a look this weekend and see
what causes the issues.
About the stream_ functions, they are indeed better. As a bonus SSL support
seems relatively easy to implement now.
Thanks a lot for adding HIXIE support to the client. Will integrate your
changes this weekend. I will also implement HIXIE in the send() / sendFrame()
methods.
Original comment by ch...@devristo.com
on 15 Dec 2011 at 7:51
Pushed your changes to git :)
Original comment by ch...@devristo.com
on 15 Dec 2011 at 8:51
Hello,
we are working together with Mamta on this project.
It is relative easy to setup a glassfish 3.1.1, here is the link:
http://glassfish.java.net/downloads/3.1.1-final.html. Please download and copy
the attached patches(Kernel.jar & soap-tcp.jar) to GF3.1.1/glassfish/modules
folder (see
http://java.net/jira/browse/GRIZZLY-1136?page=com.atlassian.jira.plugin.system.i
ssuetabpanels:comment-tabpanel&focusedCommentId=325521#action_325521).
You can find the chat example which we are using here:
(http://grizzly.java.net/ sub-project
grizzly-project/grizzly-samples/grizzly-websockets-chat and sources from here
http://grizzly.java.net/nonav/docs/docbkx1.9/html/ch01s02.html ). Add the
attached libraries (glassfish_modules_grizzly_1.9.42) for grizzly in the
GF3.1.1/glassfish/modules folder.
After you install the glassfish and a domain you can deploy demo Web App
(*.war/ear) over the admin web console normally located here: localhost:4848
(if not changed during the instalation).
Greetings,
Todor
Original comment by t.gitc...@gmail.com
on 16 Dec 2011 at 1:53
Attachments:
Thanks for the pointers, hope I find some time soon to get it all up and
running :)
Original comment by ch...@devristo.com
on 16 Dec 2011 at 4:41
Installing GF now :)
Original comment by ch...@devristo.com
on 22 Dec 2011 at 6:30
[deleted comment]
Glassfish install fails with 'The system cannot find the path specified'.
Running Windows 8 DP. But every Java app up till now worked without any issues.
Any ideas?
Original comment by ch...@devristo.com
on 22 Dec 2011 at 6:50
Anyway, lots of code in the client changed today. Maybe you are lucky and it
works now.
Original comment by ch...@devristo.com
on 24 Dec 2011 at 11:40
The php client still cause the server to call onClose event, after debugging we
found out that Draft07Handler.java line number 100 gives the protocol error
throw new ProtocolError("RSV bit(s) incorrectly set.");
Could you suggest something?
Original comment by mamta.hi...@googlemail.com
on 4 Jan 2012 at 12:52
Attachments:
[deleted comment]
The RSV bits are reserved, PHPWS doesnt do anything with those (they are set to
0).
The java file attached suggest that during decoding, that one or more of them
are 1. The whole decoding part in the java is a bit strange to me. The RSV bits
are not part of the 'opcode', however their approach *should* work as well.
Looks like the opcode returned by *checkForLastFrame()* is incorrect.
Original comment by ch...@devristo.com
on 5 Jan 2012 at 9:48
Hmmm seems I mixed up a bit, its not checkForLastFrame() but the following line
that could be wrong:
byte opcode = handler.get();
I am not sure what handler.get() does, so it might go wrong earlier in the
chain.
Original comment by ch...@devristo.com
on 5 Jan 2012 at 9:50
Will close this one since no activity since January. Let me know if there is
something I can do.
Original comment by ch...@devristo.com
on 23 Mar 2012 at 7:03
Original issue reported on code.google.com by
mamta.hi...@googlemail.com
on 30 Nov 2011 at 9:00