Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the example can not run ,the client send msg but the server cont not receiver msg #79

Open
lizhichao999 opened this issue Sep 13, 2018 · 4 comments

Comments

@lizhichao999
Copy link

the example can not run ,the clint send msg but the server cont not receiver msg
for example:

the server:
public static void main(String[] args) {
JSONServerSample jsonServer = new JSONServerSample();
try {
jsonServer.started();
//jsonServer.sendClearCacheRequest();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

the client:
public static void main(String[] args) throws Exception {
JSONClientSample jsonClient = new JSONClientSample();

	try {
    	jsonClient.connect();
    	
    	jsonClient.sendBootNotification();
    	Thread.sleep(100000L);
    	jsonClient.disconnect();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
@lizhichao999 lizhichao999 changed the title the example can not run ,the clint send msg but the server cont not receiver msg the example can not run ,the client send msg but the server cont not receiver msg Sep 13, 2018
@TVolden
Copy link
Member

TVolden commented Sep 13, 2018

Hi @lizhichao999

The sample server should print to console. If you don't see that, you should check your firewall.

@lizhichao999
Copy link
Author

lizhichao999 commented Sep 13, 2018

@TVolden 1.How to send messages on the server side and the client accept
2,if the server class method handleBootNotificationRequest return new BootNotificationConfirmation();rp
why the client can not print anything ,
client.send(request).whenComplete((s, ex) ->{

    	System.out.println("=================");
    	System.out.println("---->"+s);
    	ex.printStackTrace();
    });

@TVolden
Copy link
Member

TVolden commented Sep 13, 2018

Hi @lizhichao999

In the sample code I provide, you can call sendClearCacheRequest() to try a server to client request.
If you want the server/client to send other requests, you have to implement them yourself :)

Hmm. I never thought about this, but my sample code, would not be able to communicate out of the box.
It would be nice, if the client didn't return a not implemented error when the server sends a clear cache request and wise versa for the server when the client sends a boot notification request.

Anyway, if you instantiated a BootNotificationConfirmation and set the required fields (status, currentTime and interval), then the client should receive the response.

@TVolden
Copy link
Member

TVolden commented Oct 20, 2018

Any news on this issue @lizhichao999?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants