Comments (4)
I was able to solve client registration issue with below code:
final LeshanClient client = leshanClientBuilder
.setEndpointsProviders(new CaliforniumClientEndpointsProvider.Builder().build())
.build();
Setting clientAddress to CaliforniumClientEndpointsProvider was my mistake: "endpointsBuilder.setClientAddress(InetAddress.getLocalHost());"
With this change the client is working fine now.
So now only issue persist is of Leshan WebServer UI is not working at http://localhost:8080
I have added below code for WebServer.
// Starting jetty webserver for UI at http://localhost:8080
InetSocketAddress jettyAddr = new InetSocketAddress("127.0.0.1", 8080);
Server jettyServer = new Server(jettyAddr);
jettyServer.start();
Any suggestions / help would be great.
Thank you for your attention!
from leshan.
I looked at your server code and it should rather looks like :
// create provider
final CaliforniumServerEndpointsProvider californiumServerEndpointsProvider = new CaliforniumServerEndpointsProvider.Builder(
new CoapServerProtocolProvider()) //
.setConfiguration(config -> config.set(CoapConfig.PROTOCOL_STAGE_THREAD_COUNT, 4))
.addEndpoint("coap://localhost:5683") //
// OR
// .addEndpoint(new InetSocketAddress("localhost", 5683), Protocol.COAP) //
.build();
// create server
LeshanServerBuilder builder = new LeshanServerBuilder();
// builder.setRegistrationIdProvider(new RandomStringRegistrationIdProvider()); // not needed used by default
builder.setEndpointsProviders(californiumServerEndpointsProvider);
LeshanServer server = builder.build();
// start it
server.start();
// listen for registration
server.getRegistrationService().addListener(new RegistrationListener() {
@Override
public void registered(Registration registration, Registration previousReg,
Collection<Observation> previousObservations) {
System.out.println("Registered client: " + registration.getEndpoint());
}
// Other override methods
});
// All the jetty code is useless OR it missed your own code to add `Servlet` to jetty.
So now only issue persist is of Leshan WebServer UI is not working at http://localhost:8080/
Leshan is a library, there is no web server UI.
But Leshan provide a standalone demo which contains a web UI.
See FAQ to better understand : https://github.com/eclipse-leshan/leshan/wiki/F.A.Q.#what-is-leshan-and-how-should-i-use-it-
Maybe I should change again the README + FAQ, as it seems not clear for everybody 🤔
from leshan.
Thank you very much @sbernard31. Now it's clear to me and thanks for the code. I will change my code accordingly. Satisfied with the answer and good to close this issue. Thanks again...
from leshan.
You're welcome.
from leshan.
Related Issues (20)
- Add CoAP over TLS (over TCP) transport layer HOT 1
- Should Leshan client port be configurable? HOT 2
- Best way to test queue mode with Leshan server and leshan client demo 2.0 ? HOT 6
- Queue mode doesnt seem to work when testing Leshan client 2.0 + server 2.0 HOT 8
- Parallel Requests Handling in Leshan Server HOT 4
- Demo server configure PSK ID and PSK content HOT 4
- FW update test HOT 3
- CoAP version 0 not supported HOT 3
- [Feature Request] Ability to monitor request-response lifecycle HOT 9
- Add new object HOT 3
- Plan for 2.0.0-M15 🎯 HOT 24
- Is OMA Object 9 resource 12 correct? HOT 2
- Is Leshan server ready for production in industry ? HOT 11
- [Firmware Update][Blockwise] HOT 8
- Should sending timestamped data in an observation request response be a supported use case? HOT 14
- The addition of a resource instance is not detected by LwM2mTestObject (3442) HOT 3
- Precision loss when deserialize BigDecimal with SenMLJSON / old JSON content format. HOT 1
- Fail to decode empty response to a Read operation HOT 3
- How Timstamp should be handled in LWM2M/Leshan ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leshan.