BlazeDS Channel connects and disconnects immediately
I am connecting to a BlazeDS server with a simple Flex component that is merely trying to subscribe to realtime data
Here are the Channels and Consumer <mx:ChannelSet id="channelSet">
<mx:AMFChannel url="http://localhost:8080/MyApp/messagebroker/streamingamf/"/>
</mx:ChannelSet>
<mx:Consumer id="consumer"
destination="feed"
channelSet="{channelSet}"
开发者_JAVA百科 channelConnect="consumer_channelConnectHandler(event)"
channelDisconnect="consumer_channelDisconnectHandler(event)"
message="consumer_messageHandler(event.message)"
fault="consumer_faultHandler(event)"/>
I am being disconnected right after connecting (both consumer_channelConnectHandler and consumer_channelDisconnectHandler are invoked).
Would you have a clue why?There's a couple of things to note here:
You have a StreamingAMF endpoint configured to an AMFChannel. This is wrong, I suspect you want a
StreamingAMFChannel
.If you're using an
AMFChannel
with a consumer, you need to talk to anAMFLongPolling
endpoint, in which case yourAMFChannel
should havepollingEnabled
set to true. however, I suspect you really wantStreamingAMFChannel
, in which case, see point 1.Once you configure
StreamingAMFChannel
, you can find that you still get immediate disconnections on the client. This occurs when you have multiple connections from the same client (ie., tabs), and yourservices-config.xml
has amax-streaming-connections-per-session
set too low. Normally you would want this set to 1, but for development, that can be painful, so set it higher, and use a seperateservices-config.xml
with production settings for production.
精彩评论