It is currently 18 Jul 2025, 21:58
   
Text Size

JBoss, Client-Server connection and Android

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

JBoss, Client-Server connection and Android

Postby Endless » 14 May 2015, 18:45

So, for a while now I've been toying with the idea of writing an Android client for Xmage. I'm aware that representing such a complex game on anything smaller than a full-sized monitor is a challenge, to say the least, but I'm fine with that. That's a fun challenge, and for now this is a toy project anyway.

When I approached LevelX with this elsewhere, it was suggested I might have difficulties with JBoss. Guided by this comment, I decided to start by trying to establish a basic connection to one of the servers.
Unsurprisingly, I had difficulties.

I've managed to compile and import MageCommon into an android app, but all of my attempts to start a connection have failed miserably. So, before I go too deep into this, I wanted to ask a couple of question since you certainly know more about this than me.

I apologise if these are stupid questions, I have zero experience with how JBoss works.

  • Can the client part of JBoss run on Android or is it just completely incompatible? I'm guessing it's incompatible, but if it's compatible then I can start investigating why I've failed so far.
  • If it is incompatible, is it possible for a client to connect to an xmage server without JBoss? Is there a specification of what a client needs to do to connect to an xmage server?


Thanks for any help
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby BetaSteward » 15 May 2015, 13:05

Hi Endless,

I don't have any experience with coding for Android so I can't speak to why JBoss Remoting doesn't work on that platform. However I can report that I am making good progress on converting the IO framework to Netty which has good Android support. I am currently looking at using plain sockets but I could easily change to using web sockets if it makes it easier for other platforms.

I will be committing my code to a new branch in a few days time. I wouldn't put in any more effort trying to get JBoss Remoting working. Instead you could spend your time getting familiar with Netty.

Regards,

BetaSteward
BetaSteward
DEVELOPER
 
Posts: 129
Joined: 28 Mar 2010, 13:15
Has thanked: 6 times
Been thanked: 29 times

Re: JBoss, Client-Server connection and Android

Postby LevelX » 15 May 2015, 21:24

BetaSteward wrote:Hi Endless,

I don't have any experience with coding for Android so I can't speak to why JBoss Remoting doesn't work on that platform. However I can report that I am making good progress on converting the IO framework to Netty which has good Android support. I am currently looking at using plain sockets but I could easily change to using web sockets if it makes it easier for other platforms.

I will be committing my code to a new branch in a few days time. I wouldn't put in any more effort trying to get JBoss Remoting working. Instead you could spend your time getting familiar with Netty.

Regards,

BetaSteward
Hey that sounds great!
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: JBoss, Client-Server connection and Android

Postby Endless » 16 May 2015, 08:44

Thanks BetaSteward, that's great to hear.
I'll let go of JBoss and keep an eye out for the new branch.

I've never worked with sockets, but doing a little research seems to indicate that plain sockets work fine on android. So just do what works best on your side.

Cheers,
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby BetaSteward » 23 May 2015, 14:35

Take a look at the new branch Network_Upgrade. It's pretty rough at the moment but you should get an idea of how it will work.
BetaSteward
DEVELOPER
 
Posts: 129
Joined: 28 Mar 2010, 13:15
Has thanked: 6 times
Been thanked: 29 times

Re: JBoss, Client-Server connection and Android

Postby Endless » 23 May 2015, 16:36

Thanks, I'm pulling the branch now. Sadly, I'm swamped with reports to mark so it'll take me some time to dive into it.
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby Endless » 24 May 2015, 09:34

Quick question.

- I've made a dummy class inheriting network.interfaces.MageClient,
- I pass it to the constructor of the network Client class to create a Client object.
- I call `.connect(...)` on this Client object, and I think this works because the MageClient.connected() method is getting invoked.

What's the minimum number of steps to get some form of chat communication going? Is there a java file you can point me to for that? I'm reading through the code, but I haven't been able to find that part yet.


Cheers,
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby Endless » 24 May 2015, 10:01

Ok, I think I found the relevant code. From what I understand (correct me if I'm wrong), I need to:

- Get a roomID with the `client.getServerState().getMainRoomId()`.
- Use that to get the room's chat ID with `.getRoomChatId`.

Now the problem I have is that the client's serverState is never set, because its `clientRegistered()` method is never called.

With a little more investigation, it seems that this method is supposed to be called by the `messageReceived()` method of `ClientRegisteredMessageHandler`, but *that* method is never called in the code. So I assume that's what you meant when you said it's still a little rough? :-)
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby BetaSteward » 24 May 2015, 14:35

Yeah, the code is still a bit rough since there is very little error handling/notification. It is possible that your attempt to connect to the server was unsuccessful or is still pending.

Once the server receives a connect message and creates a session it is supposed to send back the ServerState. In my tests this can take a few seconds to happen since it happens asynchronously. You can try polling the variable for when it becomes non-null. I think I will need to make the connect() call synchronous.
BetaSteward
DEVELOPER
 
Posts: 129
Joined: 28 Mar 2010, 13:15
Has thanked: 6 times
Been thanked: 29 times

Re: JBoss, Client-Server connection and Android

Postby Endless » 25 May 2015, 15:35

Thanks, I found my issue. Things seem to be going forward now.
I can connect to my server and receive chat messages. Now trying to figure out how to send them.
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby Endless » 26 May 2015, 17:20

That's odd. It was working yesterday, but now it isn't. I've managed to successfully `.connect()` to the server, and then `serverstate.getMainRoomId()`, but when I try to `.getRoomChatId` it just hangs indefinitely.

Do you have any idea why it could be doing that? Did I miss any setup steps?

On a separate note, when running the Mage.Client project, the chat works for a few minutes, and eventually just stops. Could that be related?
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby Endless » 26 May 2015, 18:07

Ok. It seems to work if I wait a second or two between getting the room id and getting the chat id. Doesn't make much sense to me, since they're both synchronous requests (IIUC), but it could be Android killing the thread or something.
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby bestdayever » 23 Jun 2015, 13:00

Has any work moved forward on an android client? Is there a repo at this point?
bestdayever
 
Posts: 4
Joined: 23 Jun 2015, 12:56
Has thanked: 0 time
Been thanked: 1 time

Re: JBoss, Client-Server connection and Android

Postby Endless » 23 Jun 2015, 14:08

Yes, there's some work.
Right now it can connect to a server (as long as it's using the new network branch) and chat on the server. It can also view deck files.

I noticed that tables were implemented in network branch a couple of weeks ago, but I've been busy since then so progress has stoped.

I'll push it to github this week if people want to follow/help. But I should warn you it's written in clojure. :-)
Endless
 
Posts: 12
Joined: 14 May 2015, 18:09
Has thanked: 0 time
Been thanked: 0 time

Re: JBoss, Client-Server connection and Android

Postby bestdayever » 23 Jun 2015, 14:18

How set are you on clojure? I wouldn't mind trying to do it but I'm worried about losing some of the fancier java libs (dagger for DI, etc). Do you have a MVP structure or how would you describe the design pattern? I would love to take a look.
bestdayever
 
Posts: 4
Joined: 23 Jun 2015, 12:56
Has thanked: 0 time
Been thanked: 1 time

Next

Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 0 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 0 guests

Login Form