Where do SpiderMonkey's setReliable methods come from?

I’m reading the UDP vs TCP section of the SpiderMonkey docs.

It shows a setReliable(boolean) method on some messages like so:

message1.setReliable(true); // TCP
message2.setReliable(false); // UDP

What classes are message1 and message2 instances of? My understanding was that, in SpiderMonkey, messages are just classes w/ no-arg constructors and which are annotated with com.jme3.network.serializing.Serializable. But that doesn’t force any API/contract on the message objects.

So am I supposed to have my messages extends some base “message class”? If not where does that setReliable(boolean) method come from?

They are extending AbstractMessage. Have a look at the “Creating Message Types” section :slight_smile:

Or the javadoc…
http://javadoc.jmonkeyengine.org/com/jme3/network/Client.html#send-int-com.jme3.network.Message-

As a “java developer”, if the javadocs aren’t one click away for you then you should probably just quit right now. :wink: So helpful and they answer most of the easy questions in 5 seconds.

“what class are messages? Well, how do we send them?”

“Ah… send() takes a Message class…”
One more click…
http://javadoc.jmonkeyengine.org/com/jme3/network/Message.html#setReliable-boolean-

“Ah… that’s where that method is defined.”

…in less time than it takes to open the forum and type a question.

Meh, I like watching you have back and forth conversations with yourself @pspeed.

No, that wasn’t me. That was a hypothetical user who knows how to use javadoc. I was just quoting them. (Thus the quotation marks.)

1 Like

Paul’s inner dialogue and self conversations take place in bytecode

Heheh… no, but one of my wi-fi passwords is an inside Java joke. (cafebabe)

1 Like