Ajax, WebSocket, Unix socket. Any implementation on neko?

103 views
Skip to first unread message

Horsetopus

unread,
Jun 15, 2016, 1:11:59 PM6/15/16
to Haxe
Hi,

So, I'm working on a video conference solution.
I'm using the very interesting Janus Gateway, which handles a lot for sharing webcams, video streams and such through WebRTC.
But Janus handles very little in therms of user management. Basically it make its API available to anybody with the right links, and any viewer will have the links but I don't want every viewers to have the rights to broadcast.
So for going deeper and locking a bit the security, I have to set my application as a proxy for every request.

My server is running on the Neko VM and everything works fine, but to communicate with Janus, I need to use one of the following:
Ajax
Websocket
Unix sockets.

And I couldn't find anything...
Of course some are availlable on the js package, but what about neko?
Can I establish a websocket from neko?
Can I make a XMLHttpRequest?
Can I use Unix sockets?

I'm not even sure Websocket can be established from anything else than a browser.
But what about sending an XMLHttpRequest from neko?
And what about Unix sockets? sys.net.socket seems to work only with host/port parameters.

Any input is welcome.
Thanks.

Horsetopus

unread,
Jun 16, 2016, 6:31:07 AM6/16/16
to Haxe
Sorry, I will up this a bit, because I have no clue what to do if none of these works...
Or actually, I do, and it bothers me quite a bit... ( either tap into the janus source code, or make a 3rd application just to channel the messages. Who would want that? ).

Munir Hussin

unread,
Jun 16, 2016, 7:00:22 AM6/16/16
to Haxe
sys.net.Socket should be able to implement any protocol. As a matter of fact, this websocket library (https://bitbucket.org/yar3333/haxe-websocket) uses sys.net.Socket to implement the websocket protocol. I've used that library for making a websocket server on neko, though I haven't tried using that as a websocket client (in neko).

Horsetopus

unread,
Jun 16, 2016, 9:38:00 AM6/16/16
to Haxe
I also use this websocket library, and on the server side it works like a charm.
But I am not sure this is possible to use as a client.
I guess I can try to write to the library writer, though...

Thank you for your input.

Bruno Santos

unread,
Jun 16, 2016, 6:30:36 PM6/16/16
to Haxe

Have a look at the hxnet project:https://github.com/MattTuttle/hxnet

It implements the websocket protocol over sys.net.sockets.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Horsetopus

unread,
Jun 17, 2016, 6:55:53 AM6/17/16
to Haxe
Thank you Bruno, I'll keep in mind in case I 
But I managed with haxe-websocket, after contacting the author.

outgoingWebSocket = WebSocket.connect( "localhost", port, "localhost", "https://localhost", "randomly_generated_key" );

I attached a running sample for those who would be interested, where I listen to incoming websocket and for each of them create an outcoming websocket.
Then for every incoming message, in both ways, if forward it to it's associated websocket.
The goal of course is to intercept any non-allowed message to go through.
Main.hx
Reply all
Reply to author
Forward
0 new messages