io.socket.yeast.Yeast类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中io.socket.yeast.Yeast类的一些代码示例,展示了Yeast类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yeast类的具体详情如下:
包路径:io.socket.yeast.Yeast
类名称:Yeast

Yeast介绍

[英]A Java implementation of yeast. https://github.com/unshiftio/yeast
[中]酵母的Java实现。https://github.com/unshiftio/yeast

代码示例

代码示例来源:origin: io.socket/engine.io-server

public static String yeast() {
    return Yeast.encode(VALUE.incrementAndGet());
  }
}

代码示例来源:origin: io.socket/engine.io-client

protected String uri() {
    Map<String, String> query = this.query;
    if (query == null) {
      query = new HashMap<String, String>();
    }
    String schema = this.secure ? "wss" : "ws";
    String port = "";

    if (this.port > 0 && (("wss".equals(schema) && this.port != 443)
        || ("ws".equals(schema) && this.port != 80))) {
      port = ":" + this.port;
    }

    if (this.timestampRequests) {
      query.put(this.timestampParam, Yeast.yeast());
    }

    String derivedQuery = ParseQS.encode(query);
    if (derivedQuery.length() > 0) {
      derivedQuery = "?" + derivedQuery;
    }

    boolean ipv6 = this.hostname.contains(":");
    return schema + "://" + (ipv6 ? "[" + this.hostname + "]" : this.hostname) + port + this.path + derivedQuery;
  }
}

代码示例来源:origin: io.socket/engine.io-client

protected String uri() {
  Map<String, String> query = this.query;
  if (query == null) {
    query = new HashMap<String, String>();
  }
  String schema = this.secure ? "https" : "http";
  String port = "";
  if (this.timestampRequests) {
    query.put(this.timestampParam, Yeast.yeast());
  }
  String derivedQuery = ParseQS.encode(query);
  if (this.port > 0 && (("https".equals(schema) && this.port != 443)
      || ("http".equals(schema) && this.port != 80))) {
    port = ":" + this.port;
  }
  if (derivedQuery.length() > 0) {
    derivedQuery = "?" + derivedQuery;
  }
  boolean ipv6 = this.hostname.contains(":");
  return schema + "://" + (ipv6 ? "[" + this.hostname + "]" : this.hostname) + port + this.path + derivedQuery;
}

代码示例来源:origin: io.socket/engine.io-client

public static String yeast() {
    String now = encode(new Date().getTime());

    if (!now.equals(prev)) {
      seed = 0;
      prev = now;
      return now;
    }

    return now + "." + encode(seed++);
  }
}

相关文章