资源简介
最新完整的代码,有需要的朋友拿走吧。java版本的websocket组件包。
代码片段和文件信息
/*
* Copyright (c) 2010-2018 Nathan Rajlich
*
* Permission is hereby granted free of charge to any person
* obtaining a copy of this software and associated documentation
* files (the “Software“) to deal in the Software without
* restriction including without limitation the rights to use
* copy modify merge publish distribute sublicense and/or sell
* copies of the Software and to permit persons to whom the
* Software is furnished to do so subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND
* EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY
* WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING
* FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.Jframe;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import org.java_websocket.WebSocketImpl;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft;
import org.java_websocket.drafts.Draft_6455;
import org.java_websocket.handshake.ServerHandshake;
public class ChatClient extends Jframe implements ActionListener {
private static final long serialVersionUID = -6056260699202978657L;
private final JTextField uriField;
private final JButton connect;
private final JButton close;
private final JTextArea ta;
private final JTextField chatField;
private final JComboBox draft;
private WebSocketClient cc;
public ChatClient( String defaultlocation ) {
super( “WebSocket Chat Client“ );
Container c = getContentPane();
GridLayout layout = new GridLayout();
layout.setColumns( 1 );
layout.setRows( 6 );
c.setLayout( layout );
Draft[] drafts = { new Draft_6455() };
draft = new JComboBox( drafts );
c.add( draft );
uriField = new JTextField();
uriField.setText( defaultlocation );
c.add( uriField );
connect = new JButton( “Connect“ );
connect.addActionListener( this );
c.add( connect );
close = new JButton( “Close“ );
close.addActionListener( this );
close.setEnabled( false );
c.add( close );
JScrollPane scroll = new JScrollPane();
ta = new JTextArea();
scroll.setViewportView( ta );
c.add( scroll );
chatField = new JTextField();
chatField.setText( ““ );
chatField.addActionListener( this );
c.add
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-02-15 18:22 Java-WebSocket-master\
目录 0 2018-02-15 18:22 Java-WebSocket-master\.github\
文件 1343 2018-02-15 18:22 Java-WebSocket-master\.github\ISSUE_TEMPLATE.md
文件 1545 2018-02-15 18:22 Java-WebSocket-master\.github\PULL_REQUEST_TEMPLATE.md
文件 148 2018-02-15 18:22 Java-WebSocket-master\.gitignore
文件 48 2018-02-15 18:22 Java-WebSocket-master\.travis.yml
文件 29421 2018-02-15 18:22 Java-WebSocket-master\CodeFormatterProfile.xm
文件 1082 2018-02-15 18:22 Java-WebSocket-master\LICENSE
文件 6360 2018-02-15 18:22 Java-WebSocket-master\README.markdown
目录 0 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\
目录 0 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\clients\
文件 250629 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\clients\index.html
目录 0 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\servers\
文件 423037 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\servers\index.html
文件 109880 2018-02-15 18:22 Java-WebSocket-master\autobahn reports\servers\index.json
文件 840 2018-02-15 18:22 Java-WebSocket-master\build.gradle
文件 1791 2018-02-15 18:22 Java-WebSocket-master\build.xm
文件 3609 2018-02-15 18:22 Java-WebSocket-master\pom.xm
目录 0 2018-02-15 18:22 Java-WebSocket-master\src\
目录 0 2018-02-15 18:22 Java-WebSocket-master\src\main\
目录 0 2018-02-15 18:22 Java-WebSocket-master\src\main\example\
文件 5701 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ChatClient.java
文件 3677 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ChatServer.java
文件 3894 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ChatServerAttachmentExample.java
文件 2847 2018-02-15 18:22 Java-WebSocket-master\src\main\example\CustomHeaderClientExample.java
文件 2971 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ExampleClient.java
文件 3608 2018-02-15 18:22 Java-WebSocket-master\src\main\example\Fragmentedfr
文件 1562 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ProxyClientExample.java
文件 1953 2018-02-15 18:22 Java-WebSocket-master\src\main\example\ReconnectClientExample.java
文件 3982 2018-02-15 18:22 Java-WebSocket-master\src\main\example\SSLClientExample.java
文件 4033 2018-02-15 18:22 Java-WebSocket-master\src\main\example\SSLServerCustomWebsocketFactoryExample.java
............此处省略134个文件信息
- 上一篇:JAVA国际象棋
- 下一篇:java版FPgrowth
相关资源
- jmeter增加websocket插件所需依赖包全
- java实现基于websocket的聊天室
- websocket需要用到jar包
- websocket实现前端页面动态刷新数据库
- 基于Websocket的简单聊天室
- websocket 依赖包,android和java都可以
- jmeter测试websocket依赖包
- javax.websocket-api-1.0.jar
- 基于WebSocket实现的Android和H5聊天通讯
- websocket-api.jar JAVAjar包
- Jmeter websocket
- java版本websocket
- 基于WebSocket实现的Android和H5聊天通讯
- Java-WebSocket-jar
- Android端websocket调用(含autobahn-0.5.0.
- android websocket demo
- spring boot+websocket前后端简单demo
- Java WebSocket爬虫
- QWebSocket-for-Android-openssl库
- javax.websocket-api-1.1
- 一个机遇JAVA Web的websocket
- jmeter-websocket-jar
- Web微信 SpringMVC使用Socket做聊天链接
- java-websocket jar包
- websocket-api jar包 程序文件
- netty服务端及客户端,支持HTTP和WEBS
- jmeter的websocket插件jar包
- websocket即时通讯后台代码
- 支持ws与wss的websocket协议的jmeter插件
- Jmeter WebSocket Sampler 依赖文件
评论
共有 条评论