Hi to all,
Well i recently downloaded APE and i struggled a lot but finally i
manage to undestand how APE works. Actually i am creating a Socket on
the Server which will listen to C++ application i.e....
The Server will create a socket and will accept data from external
application via this socket which will later be transferred to
clients(browsers) by means of channels.
Everything works fine till now until i got a new requirement which
stipulates that on the event socket.onAccept i should verify the
calling application IP Address, a UserName and Password...which means
that any application which want to send data to the created socket has
to supply a username and password and also the ip address which will
be used to verify whether the calling application has the necessary
rights to send data to this socket or not else the client will be
disconnected..
My question is simple, I would like to know how i can implement this
on the Server Side Javascript code..I would like to precise that
Server code i utilise for the Sockets is really very simple and is a
follows:
/* Listen on port 6972 (multicast) and high performances server */
var port = 6972;
var socket = new Ape.sockServer(port, "0.0.0.0", {
flushlf: true /* onRead event is fired only when a \n is received
(and splitted around it)*/
});
/* fired when a client is connecting */
socket.onAccept = function(client) {
//client.write(client);
}
/* fired when a client send data */
socket.onRead = function(client, data) {
var msg = data.split(";")
if (msg.length == 2)
{
var channel = new Ape.getChannelByName(msg[0]);
if (channel!=null)
{
//Send Data to the channel
channel.pipe.sendRaw('data', {"data":
msg[1]});
}
}
}
/* fired when a client has disconnected */
socket.onDisconnect = function(client) {
Ape.log("A client has disconnected");
}
I am waiting for replies from all those who have encountered the issue
and got a solution for it...
Thanks in advance to all those who will reply to this question.
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/