在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:TooTallNate/Java-WebSocket开源软件地址:https://github.com/TooTallNate/Java-WebSocket开源编程语言:Java 57.6%开源软件介绍:Java WebSocketsThis repository contains a barebones WebSocket server and client implementation
written in 100% Java. The underlying classes are implemented Implemented WebSocket protocol versions are: Here some more details about protocol versions/drafts. PerMessageDeflateExample enable the extension with reference to both a server and client example. Getting StartedDependency management toolsBelow is a brief guide to using dependency management tools like maven or gradle. MavenTo use maven add this dependency to your pom.xml: <dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.3</version>
</dependency> GradleTo use Gradle add the maven central repository to your repositories list: mavenCentral() Then you can just add the latest version to your build. compile "org.java-websocket:Java-WebSocket:1.5.3" Or this option if you use gradle 7.0 and above. implementation 'org.java-websocket:Java-WebSocket:1.5.3' LoggingThis library uses SLF4J for logging and does not ship with any default logging implementation. Exceptions are using the log level Feel free to use whichever logging framework you desire and use the corresponding binding in your dependency management. If you want to get started, take a look at the SimpleLogger example. Standalone jarIf you do not use any dependency management tool, you can find the latest standalone jar here. Writing your own WebSocket ServerThe An example for a WebSocketServer can be found in both the wiki and the example folder. Writing your own WebSocket ClientThe An example for a WebSocketClient can be found in both the wiki and the example folder. ExamplesYou can find a lot of examples here. WSS SupportThis library supports wss.
To see how to use wss please take a look at the examples. If you do not have a valid certificate in place then you will have to create a self signed one.
Browsers will simply refuse the connection in case of a bad certificate and will not ask the user to accept it.
So the first step will be to make a browser to accept your self signed certificate. ( https://bugzilla.mozilla.org/show_bug.cgi?id=594502 ). The vm option It is currently not possible to accept ws and wss connections at the same time via the same websocket server instance. For some reason Firefox does not allow multiple connections to the same wss server if the server uses a different port than the default port (443). If you want to use I ( @Davidiusdadi ) would be glad if you would give some feedback whether wss is working fine for you or not. Minimum Required JDK
Other JRE implementations may work as well, but haven't been tested. LicenseEverything found in this repo is licensed under an MIT license. See
the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论