Giter Club home page Giter Club logo

vital's Introduction

vital

一个即时通讯脚手架,你可以像插件一样使用,vital只关注消息的传递,消息的持久化和用户的信息将由你自己实现。

demo (fim)

账号1:

账号2:

涉及技术

  • netty
  • protobuf
  • grpc

特性

  • 心跳检测
  • 断线重连
  • qos
  • 集群

快速开始

server

 VitalS vitalS=new VitalS();
        vitalS.cluster(true)
        .clusterPort(9091)
        .port(9001);
        vitalS.start();

client

VitalC vitalC = new VitalC();
        vitalC.serverIp("127.0.0.1").serverPort(9001);
        vitalC.setMessageCallBack(new MessageCallBack() {
            @Override
            public void onMessage(MessageWrapper messageWrapper) {
                VitalPB.TextMessage textMessage = messageWrapper.getMessage();
                System.out.println("收到来自:"+messageWrapper.getFromId()+"的消息:"+textMessage.getContent());
            }
        });

        vitalC.start("7", "213241", new RequestSendCallBack() {
            @Override
            public void onResponse(MessageWrapper response) {
                System.out.println("连接成功");
            }

            @Override
            public void onAck(MessageWrapper messageWrapper) {

            }

            @Override
            public void onException(MessageWrapper exception) {

            }
        });
        Thread.sleep(5000);
        vitalC.send("1", "hello", new SendCallBack() {
             @Override
            public void onAck(MessageWrapper messageWrapper) {
                 System.out.println("消息已送达"+messageWrapper.getMessage());
            }

             @Override
            public void onException(MessageWrapper exception) {
    
            }
        });

vital's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.