onConnect() — netty Function Reference
Architecture documentation for the onConnect() function in StompChatHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 79a0cee0_3fe1_bbec_8430_245727dc0633["onConnect()"] f937e446_8aba_2036_93fc_8020adb1953f["StompChatHandler"] 79a0cee0_3fe1_bbec_8430_245727dc0633 -->|defined in| f937e446_8aba_2036_93fc_8020adb1953f 5ef12430_b789_c7f8_301d_8283d302e997["channelRead0()"] 5ef12430_b789_c7f8_301d_8283d302e997 -->|calls| 79a0cee0_3fe1_bbec_8430_245727dc0633 f5104c6e_035e_0b9d_444a_4cc359d713bf["sendErrorFrame()"] 79a0cee0_3fe1_bbec_8430_245727dc0633 -->|calls| f5104c6e_035e_0b9d_444a_4cc359d713bf style 79a0cee0_3fe1_bbec_8430_245727dc0633 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/stomp/websocket/StompChatHandler.java lines 140–155
private static void onConnect(ChannelHandlerContext ctx, StompFrame inboundFrame) {
String acceptVersions = inboundFrame.headers().getAsString(ACCEPT_VERSION);
StompVersion handshakeAcceptVersion = ctx.channel().attr(StompVersion.CHANNEL_ATTRIBUTE_KEY).get();
if (acceptVersions == null || !acceptVersions.contains(handshakeAcceptVersion.version())) {
sendErrorFrame("invalid version",
"Received invalid version, expected " + handshakeAcceptVersion.version(), ctx);
return;
}
StompFrame connectedFrame = new DefaultStompFrame(StompCommand.CONNECTED);
connectedFrame.headers()
.set(VERSION, handshakeAcceptVersion.version())
.set(SERVER, "Netty-Server")
.set(HEART_BEAT, "0,0");
ctx.writeAndFlush(connectedFrame);
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does onConnect() do?
onConnect() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/stomp/websocket/StompChatHandler.java.
Where is onConnect() defined?
onConnect() is defined in example/src/main/java/io/netty/example/stomp/websocket/StompChatHandler.java at line 140.
What does onConnect() call?
onConnect() calls 1 function(s): sendErrorFrame.
What calls onConnect()?
onConnect() is called by 1 function(s): channelRead0.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free