| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>SpiderMonkey (Deprecated!) :: jMonkeyEngine Docs</title>
- <link rel="canonical" href="https://wiki.jmonkeyengine.org/docs/spidermonkey.html">
- <meta name="keywords" content="documentation, network">
- <meta name="generator" content="Antora 2.3.3">
- <link rel="stylesheet" href="../_/css/site.css">
- <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
- <meta property="og:description" content="SpiderMonkey (Deprecated!)">
- <meta property="og:title" content="jMonkeyEngine Docs">
- <link rel="stylesheet" href="../_/css/site-extra.css">
- <link rel="icon" href="../_/img/favicon.ico" type="image/x-icon">
- </head>
- <body class="article">
- <header class="header">
- <nav class="navbar">
- <div class="navbar-brand">
- <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
- <img alt="" src="../_/img/jMonkeyDocLogo.png" height="32" type="image/x-icon">
- </a>
- <div class="navbar-item hide-for-print">
- <input type="text" placeholder="Search docs..." id="search-input"/>
- </div>
- <button class="navbar-burger" data-target="topbar-nav">
- <span></span>
- <span></span>
- <span></span>
- </button>
- </div>
- <div id="topbar-nav" class="navbar-menu">
- <div class="navbar-end">
- <div class="navbar-item theme-switch-wrapper">
- <label class="theme-switch" for="checkbox">
- <input type="checkbox" id="checkbox" />
- <div class="slider round"></div>
- </label>
- </div>
- <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
- </div>
- </div>
- </nav>
- </header>
- <div class="body">
- <div class="nav-container" data-component="docs" data-version="master">
- <aside class="nav">
- <div class="panels">
- <div class="nav-panel-menu is-active" data-panel="menu">
- <nav class="nav-menu">
- <h3 class="title"><a href="documentation.html">Docs</a></h3>
- <ul class="nav-list">
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="documentation.html">Getting Started</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="https://javadoc.jmonkeyengine.org/v3.3.2-stable">JavaDoc</a>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="jme3.html">jMonkeyEngine 3</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Beginner Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_simpleapplication.html">Hello SimpleApplication</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_node.html">Hello Node</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_asset.html">Hello Asset</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_main_event_loop.html">Hello Main Event Loop</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_input_system.html">Hello Input System</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_material.html">Hello Material</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_animation.html">Hello Animation</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_picking.html">Hello Picking</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_collision.html">Hello Collision</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_terrain.html">Hello Terrain</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_audio.html">Hello Audio</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_effects.html">Hello Effects</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="jme3/beginner/hello_physics.html">Hello Physics</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Intermediate Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/best_practices.html">Best Practices</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/simpleapplication.html">Simple Application</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/features.html">Features</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/optimization.html">Optimization</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/faq.html">FAQ</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Math Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/math_for_dummies.html">Math For Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/math.html">Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/math.html">More Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/rotate.html">Rotate</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/math_video_tutorials.html">Math Video Tutorials</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">3D Graphics Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/scenegraph_for_dummies.html">Scenegraph for Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/beginner/hellovector.html">Hello Vector</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/terminology.html">Terminology</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/how_to_use_materials.html">How to Use Materials</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/intermediate/transparency_sorting.html">Transparency and Sorting</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/external/blender.html">Importing from Blender</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="jme3/external/3dsmax.html">Importing from 3DS Max</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="logo.html">Logo Usage</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="bsd_license.html">License</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="github_tips.html">Github Tips</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">SDK</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="sdk.html">jMonkeyEngine SDK</a>
- </li>
- </ul>
- </li>
- </ul>
- </nav>
- </div>
- <div class="nav-panel-explore" data-panel="explore">
- <div class="context">
- <span class="title">Docs</span>
- <span class="version">master</span>
- </div>
- <ul class="components">
- <li class="component is-current">
- <span class="title">Docs</span>
- <ul class="versions">
- <li class="version is-current is-latest">
- <a href="documentation.html">master</a>
- </li>
- </ul>
- </li>
- <li class="component">
- <span class="title">Wiki UI</span>
- <ul class="versions">
- <li class="version is-latest">
- <a href="../wiki-ui/index.html">master</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </aside>
- </div>
- <main class="article">
- <div class="toolbar" role="navigation">
- <button class="nav-toggle"></button>
- <nav class="breadcrumbs" aria-label="breadcrumbs">
- <ul>
- <li><a href="documentation.html">Docs</a></li>
- <li><a href="spidermonkey.html">SpiderMonkey (Deprecated!)</a></li>
- </ul>
- </nav>
- <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/docs/modules/ROOT/pages/spidermonkey.adoc">Edit this Page</a></div>
- </div>
- <div class="content">
- <article class="doc">
- <h1 class="page">SpiderMonkey (Deprecated!)</h1>
- <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" class="page">networking</a> for current documentation. See <a href="spidermonkey/migration.html" class="page">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="sect1">
- <h2 id="tutorial-trail"><a class="anchor" href="#tutorial-trail"></a>Tutorial trail</h2>
- <div class="sectionbody">
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p><a href="spidermonkey/tutorial/connection.html" class="page">Connections</a></p>
- </li>
- <li>
- <p><a href="spidermonkey/tutorial/sending_and_receiving_messages.html" class="page">Sending and receiving messages</a></p>
- </li>
- <li>
- <p><a href="spidermonkey/tutorial/serializing.html" class="page">Serialization</a></p>
- </li>
- <li>
- <p><a href="spidermonkey/tutorial/compression.html" class="page">Compression</a></p>
- </li>
- <li>
- <p><a href="spidermonkey/tutorial/services.html" class="page">Services</a></p>
- </li>
- <li>
- <p><a href="spidermonkey/tutorial/streaming.html" class="page">Streaming</a></p>
- </li>
- </ol>
- </div>
- <div class="sect2">
- <h3 id="explanation-of-spidermonkeys-inner-workings"><a class="anchor" href="#explanation-of-spidermonkeys-inner-workings"></a>Explanation of SpiderMonkey’s inner workings</h3>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="connection-protocols"><a class="anchor" href="#connection-protocols"></a>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"><a class="anchor" href="#clients"></a>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' <sup class="footnote">[<a id="_footnoteref_1" class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup> 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="sect1">
- <h2 id="serializing"><a class="anchor" href="#serializing"></a>Serializing</h2>
- <div class="sectionbody">
- <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"><a class="anchor" href="#field-serializer"></a>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" class="page">this tutorial</a> if you want to know how to register your own messages or serializers.</p>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="service-system"><a class="anchor" href="#service-system"></a>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" class="page">the service tutorial</a> on how to use this system.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="compression"><a class="anchor" href="#compression"></a>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" class="page">this tutorial</a> on how to use these special messages.</p>
- </div>
- </div>
- </div>
- <div id="footnotes">
- <hr>
- <div class="footnote" id="_footnotedef_1">
- <a href="#_footnoteref_1">1</a>. UDP is connectionless
- </div>
- </div>
- </article>
- <aside class="toc sidebar" data-title="Contents" data-levels="2">
- <div class="toc-menu"></div>
- </aside>
- </div>
- </main>
- </div>
- <footer class="footer">
- <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
- </footer>
- <script src="../_/js/site.js"></script>
- <script async src="../_/js/vendor/highlight.js"></script>
- </body>
- </html>
|