| 12345678910111213141516171819202122 |
- <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="Asciidoctor 1.5.4"><meta name="keywords" content="documentation, network"><title>SpiderMonkey (Deprecated!)</title><link rel="stylesheet" href="./asciidoctor.css">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
- <link rel="stylesheet" href="./coderay-asciidoctor.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css"><link rel="stylesheet" href="/home/travis/build/jMonkeyEngine/wiki/build/asciidoc/html5/twemoji-awesome.css"></head><body class="article toc2 toc-left"><div id="header"><div id="toolbar"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc/spidermonkey.adoc"><i class="fa fa-pencil-square" aria-hidden="true"></i></a><a href="https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc/"><i class="fa fa-plus-square" aria-hidden="true"></i></a><input dir="auto" style="position: relative; vertical-align: top;" spellcheck="false" autocomplete="off" class="searchbox__input aa-input" id="doc-search" name="search" placeholder="Search in the doc" required="required" type="search"></div><h1>SpiderMonkey (Deprecated!)</h1><div class="details"><span class="author" id="author"></span><br><span id="revnumber">version ,</span> <span id="revdate">2016/03/17 20:48</span></div><div id="toc" class="toc2"><div id="toctitle">Table of Contents</div><ul class="sectlevel1"><li><a href="#tutorial-trail">Tutorial trail</a><ul class="sectlevel2"><li><a href="#explanation-of-spidermonkey-s-inner-workings">Explanation of SpiderMonkey’s inner workings</a></li></ul></li><li><a href="#connection-protocols">Connection protocols</a></li><li><a href="#clients">Clients</a></li><li><a href="#serializing">Serializing</a><ul class="sectlevel2"><li><a href="#field-serializer">Field serializer</a></li></ul></li><li><a href="#service-system">Service system</a></li><li><a href="#compression">Compression</a></li></ul></div></div><div id="content"><div id="preamble"><div class="sectionbody"><div class="admonitionblock warning"><table><tr><td class="icon"><i class="fa icon-warning" title="Warning"></i></td><td class="content"><div class="paragraph"><p>This article covers a deprecated <abbr title="Application Programming Interface">API</abbr>! See <a href="jme3/advanced/networking.html">networking</a> for current documentation. See <a href="spidermonkey/migration.html">migration</a> for migration instructions.</p></div></td></tr></table></div>
- <div class="paragraph"><p>SpiderMonkey is a high performance Java networking engine, aiming to provide game developers a stable and efficient networking system. It’s also perfectly capable of doing anything other than game networking. SpiderMonkey is part of jME3 and can be found in the src/networking directory.
- <strong>Author:</strong> Lars 'Levia' Wesselius+
- <strong>License:</strong> <a href="http://www.opensource.org/licenses/bsd-license.php">New BSD license</a>+
- <strong>Blog:</strong> <a href="http://codeninja.me/tag/spidermonkey/">http://codeninja.me/tag/spidermonkey/</a>+
- <strong>Forum:</strong> <a href="http://jmonkeyengine.org/groups/spidermonkey/forum/">http://jmonkeyengine.org/groups/spidermonkey/forum/</a>+
- A tutorial trail can be found below, and below that all different aspects of SpiderMonkey are explained. These tutorials are to be updated upon SVN HEAD, so if new features are added in SVN, you should tutorials arriving of them soon.</p></div></div></div>
- <div class="sect2"><h3 id="tutorial-trail">Tutorial trail</h3><div class="olist arabic"><ol class="arabic"><li><p><a href="spidermonkey/tutorial/connection.html">Connections</a></p></li><li><p><a href="spidermonkey/tutorial/sending_and_receiving_messages.html">Sending and receiving messages</a></p></li><li><p><a href="spidermonkey/tutorial/serializing.html">Serialization</a></p></li><li><p><a href="spidermonkey/tutorial/compression.html">Compression</a></p></li><li><p><a href="spidermonkey/tutorial/services.html">Services</a></p></li><li><p><a href="spidermonkey/tutorial/streaming.html">Streaming</a></p></li></ol></div>
- <div class="sect2"><h3 id="explanation-of-spidermonkey-s-inner-workings">Explanation of SpiderMonkey’s inner workings</h3></div></div>
- <div class="sect1"><h2 id="connection-protocols">Connection protocols</h2><div class="sectionbody"><div class="paragraph"><p>SpiderMonkey supports both TCP and UDP, and is also extendable to provide others. Possible future protocols may be RUDP, UDP Lite, and SCTP. SCTP will be added in Java 7, and will therefore probably added to SpiderMonkey after it’s released. Please note that the language level of SpiderMonkey is 1.5, so it will definitely not be part of the standard <abbr title="Application Programming Interface">API</abbr> for a few years.</p></div></div></div>
- <div class="sect1"><h2 id="clients">Clients</h2><div class="sectionbody"><div class="paragraph"><p>SpiderMonkey creates two connections by default. A TCP connection for a reliable connection, and an UDP 'connection' <span class="footnote">[<a class="footnote" id="_footnoteref_1" href="#_footnote_1" title="View footnote.">1</a>]</span> for fast message handling. A problem arises here: these two connections mean that even though there are two connections, there’s only one client to represent both the connections. In SpiderMonkey you don’t have to worry about that. The server has a client manager which deals with this problem. Upon connecting, clients have to send a ClientRegistration message to link their TCP and UDP connections together. Upon receiving those two messages, server combines the clients into one, and provides this client to you. This means you can call both TCP and UDP methods on the client. If you still want to receive the 'local' client of a connection, you can do so by calling the appropriate messages in the Server class.</p></div></div></div>
- <div class="sect2"><h3 id="serializing">Serializing</h3><div class="paragraph"><p>Serializing is an aspect that received a lot of attention. I wanted it to be simple for people to register their own messages, but also be able to register serializers for their own object types. The system works by registering classes to serializers. Generally, a serializer does not exist without a class it can serialize - simply because it doesn’t have to: Why have a serializer when there’s nothing to serialize. A lot of work has been put into making it as efficient as possible. What can be left out, is left out, and what can optimized, is optimized.</p></div>
- <div class="sect2"><h3 id="field-serializer">Field serializer</h3><div class="paragraph"><p>The default serializer requires some explanation. This serializer serializes all classes that have no (registered) serializer. The field serializer works by saving all fields internally, so it can access them on serialization faster. The fields are taken, and their types are checked. They are put through a serializer again (which serializer depends, of course, on the data type). Then they are ready to be written to the buffer. As you can tell, this is quite a simple serializer, and should be used if your message don’t require extra attention. See <a href="spidermonkey/tutorial/serializing.html">this tutorial</a> if you want to know how to register your own messages or serializers.</p></div></div></div>
- <div class="sect1"><h2 id="service-system">Service system</h2><div class="sectionbody"><div class="paragraph"><p>The service system is in fact a tiny system. It’s meant to solve a small, but annoying problem. Imagine you have SpiderMonkey as your networking library, and other people have made extra’s for it. Excellent, of course, but they may all require different initialization! Perhaps you have to instantiate one yourself by using new, or maybe another works by calling a factory method; the service system exists to avoid that problem. All extras should use this system. Please see <a href="spidermonkey/tutorial/services.html">the service tutorial</a> on how to use this system.</p></div></div></div>
- <div class="sect1"><h2 id="compression">Compression</h2><div class="sectionbody"><div class="paragraph"><p>By default SpiderMonkey supports compressing messages. It’s been made to where you have complete freedom over what messages you wish to compress. See <a href="spidermonkey/tutorial/compression.html">this tutorial</a> on how to use these special messages.</p></div></div></div></div><div id="footnotes"><hr><div class="footnote" id="_footnote_1"><a href="#_footnoteref_1">1</a>. UDP is connectionless</div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2019-12-19 01:03:28 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
- apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
- indexName: 'jmonkeyengine',
- inputSelector: '#doc-search',
- debug: false // Set debug to true if you want to inspect the dropdown
- });</script></body></html>
|