Claridtimo ce4360f210 TLS transport wiring: full-session TLS over the Presents NIO stream
Wraps the entire client<->server TCP object stream in TLS, strictly opt-in via
an injected SSLContext (null = byte-for-byte the original plaintext behavior).

Connection: a ByteChannel _ioChannel indirection (defaults to the raw socket;
a TLS-wrapping channel when enabled). Selector registration, connection-pending
checks and close still use the raw SocketChannel.

Server (PresentsConnectionManager/PresentsConnection/ConnectionManager):
setSSLContext/isTlsEnabled; accepted sockets are wrapped in a non-blocking
ServerTlsChannel after init+registration; reads/writes route through the io
channel. tls-channel NeedsWrite/NeedsRead on write are treated as partial writes
(stashed in the existing per-connection overflow queue, retried each timed-select
tick — the server never needed OP_WRITE); on read, NeedsRead stays OP_READ and
NeedsWrite adds OP_WRITE so the re-dispatch pumps the handshake flush, cleared
after a clean read. processAuthedConnections carries the established io channel
from the authing connection to the running connection (init() would otherwise
revert it to the raw socket mid-session).

Client (Client/BlockingCommunicator): Client.setSSLContext; the connected
blocking socket is wrapped in a ClientTlsChannel (handshake driven transparently
in blocking mode); the Reader/Writer threads share it (one-unwrap + one-wrap, the
concurrency tls-channel allows).

DatagramChannelReader: fails closed — refuses to bind datagram ports while TLS is
enabled (we have no DTLS, so plaintext datagrams alongside TLS would be a footgun;
Bang binds zero datagram ports, so this never triggers today).
2026-06-29 22:02:52 +12:00
2018-09-26 16:22:59 -07:00
2010-02-10 20:32:44 +00:00
2025-02-05 11:23:35 -08:00
2015-03-17 08:29:07 -07:00
2015-03-12 11:34:57 -07:00
2004-08-27 02:12:55 +00:00
2015-03-12 11:34:57 -07:00

The Narya library

Narya provides a framework for building realtime distributed systems with an emphasis on multiplayer online games (massive or otherwise). Its various packages include:

  • presents: A distributed object and remote procedure call framework for creating realtime distributed systems.
  • crowd: A foundation for a multiplayer environment with notions of bodies and places, and support for chat and moving between places.
  • admin: Useful administrative functionality including a mechanism for declaring configuration that can be viewed and modified at runtime by an administrative client.
  • bureau: A framework for managing a network of code execution servers, which can be used to host ActionScript server-side code in addition to the Java server normally used by presents.

Javadoc documentation is provided.

Tutorials, etc.

Three Rings hosts a site called Game Gardens where the Narya library is used to develop a wide array of multi-player online games. On that site you can find tutorials and sample code relating to the use of Narya in game development.

Building

The library is built using Maven, or Ant.

The Maven build uses the standard targets:

package: builds the code and creates the jars and swcs
install: builds and installs the artifacts into your local Maven repository
test: builds and runs the unit tests

The Ant build uses the following targets:

all: builds the distribution files and javadoc documentation
compile: builds only the class files (dist/classes)
javadoc: builds only the javadoc documentation (dist/docs)
dist: builds the distribution jar files (dist/*.jar)

If you wish to build the ActionScript components via Ant, you will need to supply the location of the Flex SDK on the command line:

% ant -Dflexsdk.dir=SOMEPATH dist

Artifacts

Narya provides three different build artifacts, for differing purposes:

  • narya: contains the main Java library; exports dependencies only for libraries which are required by a running client or server.
  • naryalib: contains the main ActionScript library; exports dependencies for libraries needed when building a SWF using naryalib.
  • narya-tools: contains the code generation portions of Narya which one need integrate into their build; exports dependencies for various libraries needed when running code generation.

Narya is published to Maven Central. To add a Narya dependency to a Maven project, add the following to your pom.xml:

<dependencies>
  <dependency>
    <groupId>com.threerings</groupId>
    <artifactId>narya</artifactId>
    <version>1.15</version>
  </dependency>
</dependencies>

To add it to an Ivy, SBT, or other Maven repository using project, simply remove the vast majority of the boilerplate above.

If you prefer to download pre-built binaries, those can be had here:

Narya is extended by the Nenya and Vilya libraries which provide additional game related functionality like 2D and 3D graphics support, animated character rendering and a more sophisticated virtual world framework.

Distribution

Narya is released under the LGPL. The most recent version of the library is available at http://github.com/threerings/narya

Contact

Questions, comments, and other worldly endeavors can be handled via the Three Rings Libraries Google Group.

Narya is actively developed by the scurvy dogs at Three Rings Contributions are welcome.

S
Description
Distributed application framework, good for MMOGs
Readme 24 MiB
Languages
Java 69.1%
ActionScript 26.6%
C++ 3.1%
Go Template 0.8%
HTML 0.2%
Other 0.1%