> with JavaScript, the original binary Netrek protocol is probably a pain
to deal with(?), so perhaps using something simple yet compact (JSON comes
to mind) would be better

The JavaScript code to create binary Netrek protocol messages is already in
place at https://github.com/apsillers/html5-netrek/blob/master/js/packets.js.
I'll admit it was a bit of a pain to set up, but it's virtually complete
now, so implementing a JSON-to-binary converter wouldn't afford a large
benefit to this particular project. However, it might ease the setup cost
for new developers and new clients (i.e., they could skip the "bit of a
pain to set up" step), so there's certainly some merit to the idea.

> However, we want to take advantage of WebRTC's capability to use UDP!
> ...we could hopefully reuse most of the normal netrek UDP protocol
(inside WebRTC) once the packets are flowing.

Agreed. The NetrekConnection class (inside net.js) basically does this with
a Websocket-wrapped TCP setup, so I expect it's possible to implement a
WebRTC-wrapped UDP setup.

I feel I should also point out that the Netrek JavaScript and HTML code is
usable outside of a traditional Web browser. I've toyed with a Chrome web
app deployment using Chrome's socket APIs, which include both TCP and UDP
support. I've also made an Android application (
https://github.com/apsillers/html5-netrek/tree/phonegap; actual .apk
executable in /bin) using Phonegap and a simple TCP plugin that I wrote. I
could easily implement a UDP plugin for Phonegap and (less easily)
integrate it into the JavaScript networking code. The NetrekConnection
class in my JS code simply exposes an abstract API for sending and
receiving data that rest of the code uses; the only that needs to change
between platforms is the raw networking code that implements that API.
WebRTC is definitely the way to go for a lossy data channel in the Web
browser, but other Javascript-based platforms can expose direct TCP and UDP
APIs that don't require a proxy or interpreter at all.

That last paragraph is neither here nor there with respect to the current
topic (which is focused on Web browser support), but I thought I'd share it
just to give a more comprehensive view of future options for this code.

Andrew


Now, on the client side with JavaScript, the original binary Netrek
> protocol is probably a pain to deal with(?), so perhaps using something
> simple yet compact (JSON comes to mind) would be better (even at the
> cost of higher bandwidth usage).

On Mon, Mar 4, 2013 at 6:12 AM, James Cameron <quozl at us.netrek.org> wrote:

> On Mon, Mar 04, 2013 at 11:31:33AM +0100, Sven Neuhaus wrote:
> > Am 02.03.2013 02:40, schrieb Andrew Sillers:
> > > My proxy is a simple Websocket-to-TCP proxy, which can easily be run on
> > > the same machine as the actual server.
> >
> > Nice. However, we want to take advantage of WebRTC's capability to use
> > UDP! I think proxy-wise all we need to support WebRTC would be something
> > to initiate the UDP peer2peer connection [in this case between the
> > browser and the netrek server acting as WebRTC endpoint], we could
> > hopefully reuse most of the normal netrek UDP protocol (inside WebRTC)
> > once the packets are flowing.
> >
> > Now, on the client side with JavaScript, the original binary Netrek
> > protocol is probably a pain to deal with(?), so perhaps using something
> > simple yet compact (JSON comes to mind) would be better (even at the
> > cost of higher bandwidth usage).
>
> Yes, the original binary Netrek protocol is somewhat difficult to deal
> with using today's application languages, and has a few hidden
> behaviours that are surprising.
>
> JSON is used by the Gytha Netrek client for maintaining the
> achievements data on the user's filesystem.  I picked it for minimum
> coding time.
>
> In the context of the network protocol though, JSON is a reasonable
> tradeoff between compressibility, coding time, and performance.  It is
> a well known format.
>
> But I can't stop thinking of JSON as just another instance of Lisp
> s-expressions!  ;-)
>
> A server side protocol translator would not be difficult.  I don't see
> any great need to tightly integrate it into the shared memory system
> used by ntserv and daemon.
>
> --
> James Cameron
> http://quozl.linux.org.au/
> _______________________________________________
> netrek-dev mailing list
> netrek-dev at us.netrek.org
> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20130304/6af0c916/attachment.html>