Comments (4)
Which version of AHC are you using under the hood? Let me take a look...
from wasync.
I am using async-http-client-1.7.9.
Based on my stack trace, it seems that HTP uses JDKAsyncHttpProvider by default. I found another forum where some people mentioned that Apache and JDK providors donβt really support websockets and that only Grizzly works. I could not figure out how to change providers in the example though since the provider instantiation is created inside ACT. I had better luck using the AHC directly without wasync and following the websocket example there in github. I downloaded the Grizzley websocket jar (2.3) and created a GrizzleyAsyncHttpProvidor. I was able to get this to work:
AsyncHttpClient client = new AsyncHttpClient(new GrizzlyAsyncHttpProvider(new AsyncHttpClientConfig.Builder().build()));
String url = "ws://localhost:8084/VisualCall/websockets/?Content-Type=application/json&clientType=NS";
WebSocket socket = client.prepareGet(url)
.execute(new WebSocketUpgradeHandler.Builder().build())
.get();
WebSocket webSocketListener = socket.addWebSocketListener(new WebSocketTextListener() {
@Override
public void onMessage(String message) {
logger.log(Level.INFO, "Message Received: {0}", message);
}
@Override
public void onOpen(WebSocket websocket) {
logger.info("WebSocket Opened");
}
@Override
public void onFragment(String string, boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void onClose(WebSocket ws) {
logger.info("WebSocket Closed");
}
@Override
public void onError(Throwable thrwbl) {
logger.info("WebSocket Error");
}
});
} catch (ExecutionException ex) {
Logger.getLogger(VCBConnector.class.getName()).log(Level.SEVERE, null, ex);
}
From: Jeanfrancois Arcand [mailto:[email protected]]
Sent: Monday, January 07, 2013 5:33 AM
To: Atmosphere/wasync
Cc: Brems, Karen (HP Labs)
Subject: Re: [wasync] I cannot get sample code to work (#2)
Which version of AHC are you using under the hood? Let me take a look...
β
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-11951522.
from wasync.
You need to make sure either Netty or Grizzly jars are installed. That's why you got the error :-)
from wasync.
@brayanzimmerli take a look at the unit test. I will soon add a sample, before the 1.0 release.
from wasync.
Related Issues (20)
- Atmosphere streaming problem HOT 2
- Documentation link broken HOT 1
- WebSocketTransport - are ignoring the first text frame HOT 2
- TrackMessageSizeDecoder is aborting messages that contain "__" in the body
- NPE: scheme when opening the socket HOT 1
- reconnect with long-polling transport
- Bug in TransportsUtil.java HOT 5
- Simple HTTP pooling
- Not able to receive some specific data on Android wAsync client HOT 1
- Issue with QueryParams - string becomes too long after a number of reconnect attempts HOT 4
- Update to latest Netty HOT 2
- Exception on Socket.close()
- Nullpointer exception in atmosphere runtime 2.0.3 version HOT 1
- travis CI fails with dist: not set to trusty
- Fix build status banner to point to travis-ci.
- SSLv2Hello HandshakeException
- java.io.IOException: Connection Error 200
- Can Atmosphere be used for persistent connection from behind the firewall?
- Incomplete padding messages are propagated to message Function<String> with long-polling
- StreamTransport triggers Event.REOPENED after each message when protocol is enabled HOT 3
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 wasync.