All Projects → andyglow → websocket-scala-client

andyglow / websocket-scala-client

Licence: LGPL-3.0 license
WebSocket client based on Netty

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to websocket-scala-client

T Io
解决其它网络框架没有解决的用户痛点,让天下没有难开发的网络程序
Stars: ✭ 1,331 (+3497.3%)
Mutual labels:  netty, websocket-client
eagle
Eagle分布式rpc调用,借助Zookeeper实现服务注册和发现,基于AQS实现高性能连接池,支持分布式追踪、监控、过载保护等配置。提供Spring和SpringBoot插件,方便与Spring和SpringBoot集成。
Stars: ✭ 77 (+108.11%)
Mutual labels:  netty
Mallet
Mallet is an intercepting proxy for arbitrary protocols
Stars: ✭ 199 (+437.84%)
Mutual labels:  netty
Jelly
一款IM服务器端程序,基于Netty4.x开发,并且提供了客户端API。
Stars: ✭ 214 (+478.38%)
Mutual labels:  netty
Gopush
分布式消息推送服务,可以用于客服、推送、聊天等诸多系统的 核心组件服务!
Stars: ✭ 204 (+451.35%)
Mutual labels:  netty
Videocalling
局域网p2p视频聊天
Stars: ✭ 223 (+502.7%)
Mutual labels:  netty
Him Netty
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~
Stars: ✭ 194 (+424.32%)
Mutual labels:  netty
CampusForum
校园论坛
Stars: ✭ 62 (+67.57%)
Mutual labels:  netty
Jreactive 8583
Java Client & Server for ISO8583 & Netty
Stars: ✭ 248 (+570.27%)
Mutual labels:  netty
Mongo Java Server
Fake implementation of MongoDB in Java that speaks the wire protocol.
Stars: ✭ 211 (+470.27%)
Mutual labels:  netty
Helidon
Java libraries for writing microservices
Stars: ✭ 2,554 (+6802.7%)
Mutual labels:  netty
Thunder
⚡️ Nepxion Thunder is a distribution RPC framework based on Netty + Hessian + Kafka + ActiveMQ + Tibco + Zookeeper + Redis + Spring Web MVC + Spring Boot + Docker 多协议、多组件、多序列化的分布式RPC调用框架
Stars: ✭ 204 (+451.35%)
Mutual labels:  netty
Spring Dubbo Service
微服务 spring dubbo项目:dubbo rpc;druid数据源连接池;mybatis配置集成,多数据源;jmx监控MBean;定时任务;aop;ftp;测试;Metrics监控;参数验证;跨域处理;shiro权限控制;consul服务注册,发现;redis分布式锁;SPI服务机制;cat监控;netty服务代理;websocket;disconf;mongodb集成;rest;docker;fescar
Stars: ✭ 224 (+505.41%)
Mutual labels:  netty
Netty Websocket
a fully-functioning websocket server built on netty.
Stars: ✭ 201 (+443.24%)
Mutual labels:  netty
esa-httpclient
An asynchronous event-driven HTTP client based on netty.
Stars: ✭ 82 (+121.62%)
Mutual labels:  netty
Donkey
Modern Clojure HTTP server and client built for ease of use and performance
Stars: ✭ 199 (+437.84%)
Mutual labels:  netty
Mini Rpc
Spring + Netty + Protostuff + ZooKeeper 实现了一个轻量级 RPC 框架,使用 Spring 提供依赖注入与参数配置,使用 Netty 实现 NIO 方式的数据传输,使用 Protostuff 实现对象序列化,使用 ZooKeeper 实现服务注册与发现。使用该框架,可将服务部署到分布式环境中的任意节点上,客户端通过远程接口来调用服务端的具体实现,让服务端与客户端的开发完全分离,为实现大规模分布式应用提供了基础支持
Stars: ✭ 205 (+454.05%)
Mutual labels:  netty
Styx
Programmable, asynchronous, event-based reverse proxy for JVM.
Stars: ✭ 218 (+489.19%)
Mutual labels:  netty
small-rpc
🔥基于netty和hessian的一个轻量级RPC调用框架
Stars: ✭ 21 (-43.24%)
Mutual labels:  netty
acteur
A framework for writing lightweight, scalable servers with Guice and Netty
Stars: ✭ 66 (+78.38%)
Mutual labels:  netty

Websocket Client for Scala

Build Status mvn

WebSocket client based on Netty

Usage

build.sbt

libraryDependencies += "com.github.andyglow" %% "websocket-scala-client" % ${LATEST_VERSION} % Compile

Code

Import

import com.github.andyglow.websocket._

Simple example

  // 1. prepare ws-client
  // 2. define message handler
  val cli = WebsocketClient[String]("ws://echo.websocket.org") {
    case str =>
      logger.info(s"<<| $str")
  }

  // 4. open websocket
  val ws = cli.open()

  // 5. send messages
  ws ! "hello"
  ws ! "world"

A bit more advanced example

  // define some mutex to be able to shutdown app when message passing ends 
  val semaphore = new Semaphore(0)
  
  // define our protocol handler
  val protocolHandler = new WebsocketHandler[String]() {
    def receive = {
      case str if str startsWith "repeat " =>
        sender() ! "repeating " + str.substring(7)
        logger.info(s"<<| $str")

      case str if str endsWith "close" =>
        logger.info(s"<<! $str")
        sender().close
        semaphore.release()

      case str =>
        logger.info(s"<<| $str")
    }
  }

  // create websocket client and open connection
  val cli = WebsocketClient(Uri("ws://echo.websocket.org"), protocolHandler)
  val ws = cli.open()

  // send some messages
  ws ! "hello"
  ws ! "world"
  ws ! "repeat and close"
  
  // wait for echoed 'repeating close'
  semaphore.acquire(1)
  
  // shutdown whole the netty stack
  cli.shutdownSync()

Defining websocket handler this way we are able to communicate back straight from handler. Use sender() for that.

For more examples please see Examples Section

To run examples one can use sbt

sbt> example:run

or

sbt> example:runMain [BinaryEchoWebSocketOrg|SimplifiedTextEchoWebSocketOrg|TextEchoWebSocketOrg]

Make sure TestServer resided in test is running.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].