refactor: rename toki_socket to proto_socket across all languages
- Rename package/module from toki_socket to proto_socket in Dart, Kotlin, Python - Update crosstest implementations to use renamed packages - Add new proto_socket skill, deprecate add-toki-socket-crosstest-language skill - Update domain rules for all languages - Update documentation (README, PORTING_GUIDE, PROTOCOL, VERSIONING)
This commit is contained in:
parent
284b66a223
commit
d0754a353a
95 changed files with 277 additions and 277 deletions
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
## 새 언어 추가 절차
|
||||
|
||||
1. 새 언어 디렉터리를 만들기 전에 `agent-ops/skills/project/add-toki-socket-crosstest-language/templates/`의 문서를 복사해 패키지 README와 체크리스트 초안으로 사용한다.
|
||||
1. 새 언어 디렉터리를 만들기 전에 `agent-ops/skills/project/add-proto-socket-crosstest-language/templates/`의 문서를 복사해 패키지 README와 체크리스트 초안으로 사용한다.
|
||||
2. `PROTOCOL.md`와 `VERSIONING.md`의 현재 protocol version을 기준으로 지원 범위를 정한다.
|
||||
3. canonical proto인 `proto/message_common.proto`에서 언어별 protobuf binding을 생성한다. Go처럼 generator 전용 option이 필요하면 언어 패키지 안에 copy를 둘 수 있지만, message schema는 `tools/check_proto_sync.sh`로 검증 가능해야 한다.
|
||||
4. `Transport`와 `Communicator`를 먼저 구현하고, 그 위에 TCP/TLS+TCP/WS/WSS client/server를 올린다.
|
||||
5. 같은 언어 단위 테스트를 작성한 뒤 `agent-ops/skills/project/add-toki-socket-crosstest-language/SKILL.md`의 runner 배치 규칙에 맞춰 양방향 crosstest를 추가한다.
|
||||
5. 같은 언어 단위 테스트를 작성한 뒤 `agent-ops/skills/project/add-proto-socket-crosstest-language/SKILL.md`의 runner 배치 규칙에 맞춰 양방향 crosstest를 추가한다.
|
||||
6. README의 Implementations 표를 `Available`로 바꾸기 전에 formatter/linter, 단위 테스트, cross-language tests를 모두 통과시킨다.
|
||||
|
||||
템플릿은 시작점과 완료 조건만 고정한다. 실제 소스 구조, 패키지 매니저, async runtime은 각 언어의 관용적 선택을 따른다.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Toki Socket Protocol
|
||||
# Proto Socket Protocol
|
||||
|
||||
Binary TCP and WebSocket protocol using Protocol Buffers for message framing and type-based routing.
|
||||
Designed for bidirectional, heterogeneous communication across languages and platforms.
|
||||
|
|
|
|||
30
README.md
30
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# Toki Socket
|
||||
# Proto Socket
|
||||
|
||||
Binary socket protocol library for bidirectional, heterogeneous communication across languages and platforms.
|
||||
|
||||
|
|
@ -42,14 +42,14 @@ Protocol compatibility is tracked separately from language package versions. See
|
|||
| TypeScript | Available | [typescript/](typescript/) | Browser, Node.js |
|
||||
| Python | Available | [python/](python/) | Server, tooling, scripting |
|
||||
|
||||
New language implementations should start from [PORTING_GUIDE.md](PORTING_GUIDE.md) and the templates in [agent-ops/skills/project/add-toki-socket-crosstest-language/templates/](agent-ops/skills/project/add-toki-socket-crosstest-language/templates/). Mark an implementation available only after its same-language tests and cross-language tests pass.
|
||||
New language implementations should start from [PORTING_GUIDE.md](PORTING_GUIDE.md) and the templates in [agent-ops/skills/project/add-proto-socket-crosstest-language/templates/](agent-ops/skills/project/add-proto-socket-crosstest-language/templates/). Mark an implementation available only after its same-language tests and cross-language tests pass.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Dart)
|
||||
|
||||
```dart
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
// 1. Define your message in message_common.proto, generate with protoc
|
||||
|
||||
|
|
@ -107,13 +107,13 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
toki "toki-labs.com/toki_socket/go"
|
||||
"toki-labs.com/toki_socket/go/packets"
|
||||
protoSocket "git.toki-labs.com/toki/common-proto-socket/go"
|
||||
"git.toki-labs.com/toki/common-proto-socket/go/packets"
|
||||
)
|
||||
|
||||
func parserMap() toki.ParserMap {
|
||||
return toki.ParserMap{
|
||||
toki.TypeNameOf(&packets.TestData{}): func(b []byte) (proto.Message, error) {
|
||||
func parserMap() protoSocket.ParserMap {
|
||||
return protoSocket.ParserMap{
|
||||
protoSocket.TypeNameOf(&packets.TestData{}): func(b []byte) (proto.Message, error) {
|
||||
m := &packets.TestData{}
|
||||
return m, proto.Unmarshal(b, m)
|
||||
},
|
||||
|
|
@ -123,11 +123,11 @@ func parserMap() toki.ParserMap {
|
|||
func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
server := toki.NewTcpServer("127.0.0.1", 9090, func(conn net.Conn) *toki.TcpClient {
|
||||
return toki.NewTcpClient(conn, 30, 10, parserMap())
|
||||
server := protoSocket.NewTcpServer("127.0.0.1", 9090, func(conn net.Conn) *protoSocket.TcpClient {
|
||||
return protoSocket.NewTcpClient(conn, 30, 10, parserMap())
|
||||
})
|
||||
server.OnClientConnected = func(client *toki.TcpClient) {
|
||||
toki.AddRequestListenerTyped[*packets.TestData, *packets.TestData](
|
||||
server.OnClientConnected = func(client *protoSocket.TcpClient) {
|
||||
protoSocket.AddRequestListenerTyped[*packets.TestData, *packets.TestData](
|
||||
&client.Communicator,
|
||||
func(req *packets.TestData) (*packets.TestData, error) {
|
||||
return &packets.TestData{Index: req.GetIndex(), Message: "echo: " + req.GetMessage()}, nil
|
||||
|
|
@ -139,13 +139,13 @@ func main() {
|
|||
}
|
||||
defer server.Stop()
|
||||
|
||||
client, err := toki.DialTcp(ctx, "127.0.0.1", 9090, 30, 10, parserMap())
|
||||
client, err := protoSocket.DialTcp(ctx, "127.0.0.1", 9090, 30, 10, parserMap())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
res, err := toki.SendRequestTyped[*packets.TestData, *packets.TestData](
|
||||
res, err := protoSocket.SendRequestTyped[*packets.TestData, *packets.TestData](
|
||||
&client.Communicator,
|
||||
&packets.TestData{Index: 1, Message: "hello"},
|
||||
2*time.Second,
|
||||
|
|
@ -200,7 +200,7 @@ dart run crosstest/dart_go.dart
|
|||
|
||||
```bash
|
||||
cd kotlin
|
||||
./gradlew run -PmainClass=com.tokilabs.toki_socket.crosstest.KotlinGoKt
|
||||
./gradlew run -PmainClass=com.tokilabs.proto_socket.crosstest.KotlinGoKt
|
||||
```
|
||||
|
||||
When proto files change, also run:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Versioning
|
||||
|
||||
Toki Socket tracks protocol compatibility separately from language package versions.
|
||||
Proto Socket tracks protocol compatibility separately from language package versions.
|
||||
|
||||
## Current Versions
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## 목적 / 책임
|
||||
|
||||
Toki Socket의 Dart/Flutter 구현체를 담당한다. ProtobufClient, ProtobufServer 등 핵심 클래스를 제공하며, 크로스 언어 테스트의 기준 구현으로 동작한다.
|
||||
Proto Socket의 Dart/Flutter 구현체를 담당한다. ProtobufClient, ProtobufServer 등 핵심 클래스를 제공하며, 크로스 언어 테스트의 기준 구현으로 동작한다.
|
||||
|
||||
## 포함 경로
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## 목적 / 책임
|
||||
|
||||
Toki Socket의 Go 구현체를 담당한다. TCP/WebSocket 서버·클라이언트, TLS 지원, 타입 헬퍼 함수를 제공하며, 서버·툴링·스크립팅 용도로 사용된다.
|
||||
Proto Socket의 Go 구현체를 담당한다. TCP/WebSocket 서버·클라이언트, TLS 지원, 타입 헬퍼 함수를 제공하며, 서버·툴링·스크립팅 용도로 사용된다.
|
||||
|
||||
## 포함 경로
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## 목적 / 책임
|
||||
|
||||
Toki Socket의 Kotlin/Android 구현체를 담당한다. Android 및 JVM 환경을 대상으로 한다.
|
||||
Proto Socket의 Kotlin/Android 구현체를 담당한다. Android 및 JVM 환경을 대상으로 한다.
|
||||
|
||||
## 포함 경로
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
## 프로젝트 개요
|
||||
|
||||
**Toki Socket** — 다중 언어/플랫폼 간 양방향 통신을 위한 바이너리 소켓 프로토콜 라이브러리.
|
||||
**Proto Socket** — 다중 언어/플랫폼 간 양방향 통신을 위한 바이너리 소켓 프로토콜 라이브러리.
|
||||
|
||||
- Protocol Buffers 기반 직렬화
|
||||
- TCP 4바이트 빅엔디안 길이 프리픽스 프레이밍 / WebSocket 바이너리 프레임
|
||||
|
|
@ -69,4 +69,4 @@ VERSIONING.md — 프로토콜/패키지 버전 정책
|
|||
|
||||
| 요청 키워드 | SKILL.md |
|
||||
|------------|----------|
|
||||
| 새 언어 구현, 언어 포팅, language scaffold, 템플릿, 크로스 언어 테스트 추가, 새 언어 crosstest | `agent-ops/skills/project/add-toki-socket-crosstest-language/SKILL.md` |
|
||||
| 새 언어 구현, 언어 포팅, language scaffold, 템플릿, 크로스 언어 테스트 추가, 새 언어 crosstest | `agent-ops/skills/project/add-proto-socket-crosstest-language/SKILL.md` |
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
name: add-toki-socket-crosstest-language
|
||||
name: add-proto-socket-crosstest-language
|
||||
version: 1.0.0
|
||||
description: Plan and create new-language implementation scaffolding and toki_socket language-matrix integration tests. Use when adding language package README/checklist templates, crosstest folders, server-row orchestrators, subprocess clients, or review notes for Dart/Go/other language protocol compatibility tests, especially tests that must verify every supported server/client language pair over TCP and WebSocket for send, push, request-response, concurrent request nonce mapping, and protobuf typeName compatibility without cluttering the repository root.
|
||||
description: Plan and create new-language implementation scaffolding and proto_socket language-matrix integration tests. Use when adding language package README/checklist templates, crosstest folders, server-row orchestrators, subprocess clients, or review notes for Dart/Go/other language protocol compatibility tests, especially tests that must verify every supported server/client language pair over TCP and WebSocket for send, push, request-response, concurrent request nonce mapping, and protobuf typeName compatibility without cluttering the repository root.
|
||||
---
|
||||
|
||||
# Add Toki Socket Crosstest Language
|
||||
# Add Proto Socket Crosstest Language
|
||||
|
||||
## Purpose
|
||||
|
||||
Create the package-local scaffold for a new Toki Socket language implementation and add or update the full language compatibility matrix. Keep implementation checklists and crosstest code inside the relevant language package or this skill's templates, preserve the repository root for shared docs, and match the Dart/Go baseline behavior.
|
||||
Create the package-local scaffold for a new Proto Socket language implementation and add or update the full language compatibility matrix. Keep implementation checklists and crosstest code inside the relevant language package or this skill's templates, preserve the repository root for shared docs, and match the Dart/Go baseline behavior.
|
||||
|
||||
## Plan-First Workflow
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ Do not create plan files for casual analysis, status checks, or review-only requ
|
|||
When starting a new language implementation, copy the relevant files from:
|
||||
|
||||
```text
|
||||
agent-ops/skills/project/add-toki-socket-crosstest-language/templates/
|
||||
agent-ops/skills/project/add-proto-socket-crosstest-language/templates/
|
||||
```
|
||||
|
||||
Use the README and checklists as package-local starting points. Fill in language-specific commands, supported transports, proto generation, same-language tests, and crosstest commands before marking the implementation available.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
interface:
|
||||
display_name: "Add Proto Socket Crosstest Language"
|
||||
short_description: "Plan and add Proto Socket matrix crosstests"
|
||||
default_prompt: "Use $add-proto-socket-crosstest-language to plan and add language-matrix integration tests for a new proto_socket implementation."
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Cross-language Test Checklist
|
||||
|
||||
Use the runner layout from `agent-ops/skills/project/add-toki-socket-crosstest-language/SKILL.md`.
|
||||
Use the runner layout from `agent-ops/skills/project/add-proto-socket-crosstest-language/SKILL.md`.
|
||||
|
||||
## Runner Layout
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# <Language> Toki Socket
|
||||
# <Language> Proto Socket
|
||||
|
||||
Status: planned
|
||||
|
||||
This package implements Toki Socket protocol version `0.1` for <Language>.
|
||||
This package implements Proto Socket protocol version `0.1` for <Language>.
|
||||
|
||||
## Required Structure
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
interface:
|
||||
display_name: "Add Toki Socket Crosstest Language"
|
||||
short_description: "Plan and add Toki Socket matrix crosstests"
|
||||
default_prompt: "Use $add-toki-socket-crosstest-language to plan and add language-matrix integration tests for a new toki_socket implementation."
|
||||
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _tcpPort = 29090;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _tcpPort = 29590;
|
||||
|
|
@ -301,7 +301,7 @@ Future<void> _runKotlinClient(
|
|||
'./gradlew',
|
||||
[
|
||||
'run',
|
||||
'-PmainClass=com.tokilabs.toki_socket.crosstest.DartKotlinClientKt',
|
||||
'-PmainClass=com.tokilabs.proto_socket.crosstest.DartKotlinClientKt',
|
||||
'--args=$clientArgs',
|
||||
],
|
||||
workingDirectory: _kotlinDir,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _tcpPort = 29694;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _tcpPort = 29790;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _wsPath = '/';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _wsPath = '/';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _wsPath = '/';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _host = '127.0.0.1';
|
||||
const _wsPath = '/';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
library toki_socket;
|
||||
library proto_socket;
|
||||
|
||||
export 'src/communicator.dart';
|
||||
export 'src/transport.dart';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
name: toki_socket
|
||||
name: proto_socket
|
||||
description: Multi-language standard socket protocol library. Dart implementation.
|
||||
version: 1.0.5
|
||||
publish_to: none
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
import 'dart:mirrors';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
class _FakeCommunicator extends Communicator {
|
||||
final _FakeTransport transport = _FakeTransport();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:toki_socket/toki_socket.dart';
|
||||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
const _testPort = 19090;
|
||||
const _testPortSsl = 19091;
|
||||
|
|
@ -207,13 +207,13 @@ void main() {
|
|||
test('TestData 메시지를 서버가 수신한다', () async {
|
||||
await client.send(TestData()
|
||||
..index = 42
|
||||
..message = 'hello toki-socket');
|
||||
..message = 'hello proto-socket');
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
expect(server.receivedMessages, hasLength(1));
|
||||
expect(server.receivedMessages.first.index, equals(42));
|
||||
expect(
|
||||
server.receivedMessages.first.message, equals('hello toki-socket'));
|
||||
server.receivedMessages.first.message, equals('hello proto-socket'));
|
||||
});
|
||||
|
||||
test('여러 메시지를 순서대로 수신한다', () async {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -232,7 +232,7 @@ func TestTcpSendReceive(t *testing.T) {
|
|||
}
|
||||
defer client.Close()
|
||||
|
||||
if err := client.Send(&packets.TestData{Index: 42, Message: "hello toki-socket"}); err != nil {
|
||||
if err := client.Send(&packets.TestData{Index: 42, Message: "hello proto-socket"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
|
|
@ -58,7 +58,7 @@ func generateSelfSignedCert(t *testing.T) (serverCfg, clientCfg *tls.Config) {
|
|||
|
||||
tmpl := &x509.Certificate{
|
||||
SerialNumber: big.NewInt(1),
|
||||
Subject: pkix.Name{CommonName: "toki-socket-test"},
|
||||
Subject: pkix.Name{CommonName: "proto-socket-test"},
|
||||
NotBefore: time.Now().Add(-time.Hour),
|
||||
NotAfter: time.Now().Add(time.Hour),
|
||||
IPAddresses: []net.IP{net.ParseIP("127.0.0.1")},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket_test
|
||||
package proto_socket_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -137,13 +137,13 @@ func TestWsSendReceive(t *testing.T) {
|
|||
}
|
||||
defer client.Close()
|
||||
|
||||
if err := client.Send(&packets.TestData{Index: 42, Message: "hello toki-socket ws"}); err != nil {
|
||||
if err := client.Send(&packets.TestData{Index: 42, Message: "hello proto-socket ws"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
select {
|
||||
case msg := <-received:
|
||||
if msg.GetIndex() != 42 || msg.GetMessage() != "hello toki-socket ws" {
|
||||
if msg.GetIndex() != 42 || msg.GetMessage() != "hello proto-socket ws" {
|
||||
t.Fatalf("unexpected message: %v", msg)
|
||||
}
|
||||
case <-time.After(2 * time.Second):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package toki_socket
|
||||
package proto_socket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ protobuf {
|
|||
application {
|
||||
mainClass.set(
|
||||
(findProperty("mainClass") as String?)
|
||||
?: "com.tokilabs.toki_socket.crosstest.MainKt",
|
||||
?: "com.tokilabs.proto_socket.crosstest.MainKt",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ tasks.named<JavaExec>("run") {
|
|||
classpath = crosstestSourceSet.runtimeClasspath
|
||||
mainClass.set(
|
||||
(findProperty("mainClass") as String?)
|
||||
?: "com.tokilabs.toki_socket.crosstest.MainKt",
|
||||
?: "com.tokilabs.proto_socket.crosstest.MainKt",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
@file:JvmName("DartKotlinClientKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.DialTcp
|
||||
import com.tokilabs.toki_socket.DialTcpTls
|
||||
import com.tokilabs.toki_socket.DialWs
|
||||
import com.tokilabs.toki_socket.DialWss
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.sendRequestTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.DialTcp
|
||||
import com.tokilabs.proto_socket.DialTcpTls
|
||||
import com.tokilabs.proto_socket.DialWs
|
||||
import com.tokilabs.proto_socket.DialWss
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.sendRequestTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
@ -31,7 +31,7 @@ private interface DartClientHandle {
|
|||
|
||||
suspend fun close()
|
||||
|
||||
val communicator: com.tokilabs.toki_socket.Communicator
|
||||
val communicator: com.tokilabs.proto_socket.Communicator
|
||||
}
|
||||
|
||||
private class DartTcpHandle(
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.DialTcp
|
||||
import com.tokilabs.toki_socket.DialTcpTls
|
||||
import com.tokilabs.toki_socket.DialWs
|
||||
import com.tokilabs.toki_socket.DialWss
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.sendRequestTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.DialTcp
|
||||
import com.tokilabs.proto_socket.DialTcpTls
|
||||
import com.tokilabs.proto_socket.DialWs
|
||||
import com.tokilabs.proto_socket.DialWss
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.sendRequestTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
@ -29,7 +29,7 @@ private interface ClientHandle {
|
|||
|
||||
suspend fun close()
|
||||
|
||||
val communicator: com.tokilabs.toki_socket.Communicator
|
||||
val communicator: com.tokilabs.proto_socket.Communicator
|
||||
}
|
||||
|
||||
private class TcpHandle(
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
@file:JvmName("KotlinDartKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.TcpServer
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.WsServer
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.addRequestListenerTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.TcpServer
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.WsServer
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.addRequestListenerTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
@file:JvmName("KotlinGoKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.TcpServer
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.WsServer
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.addRequestListenerTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.TcpServer
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.WsServer
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.addRequestListenerTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
@file:JvmName("KotlinPythonKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.TcpServer
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.WsServer
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.addRequestListenerTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.TcpServer
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.WsServer
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.addRequestListenerTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
@file:JvmName("KotlinTypescriptKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.TcpServer
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.WsServer
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.addRequestListenerTyped
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.TcpServer
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.WsServer
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.addRequestListenerTyped
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
@file:JvmName("PythonKotlinClientKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.DialTcp
|
||||
import com.tokilabs.toki_socket.DialTcpTls
|
||||
import com.tokilabs.toki_socket.DialWs
|
||||
import com.tokilabs.toki_socket.DialWss
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.sendRequestTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.DialTcp
|
||||
import com.tokilabs.proto_socket.DialTcpTls
|
||||
import com.tokilabs.proto_socket.DialWs
|
||||
import com.tokilabs.proto_socket.DialWss
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.sendRequestTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
@ -29,7 +29,7 @@ private const val REQUEST_WINDOW_MS = 2_000L
|
|||
private interface PythonClientHandle {
|
||||
suspend fun send(data: TestData)
|
||||
suspend fun close()
|
||||
val communicator: com.tokilabs.toki_socket.Communicator
|
||||
val communicator: com.tokilabs.proto_socket.Communicator
|
||||
}
|
||||
|
||||
private class PythonTcpHandle(
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
@file:JvmName("TypescriptKotlinClientKt")
|
||||
|
||||
package com.tokilabs.toki_socket.crosstest
|
||||
package com.tokilabs.proto_socket.crosstest
|
||||
|
||||
import com.tokilabs.toki_socket.Communicator
|
||||
import com.tokilabs.toki_socket.DialTcp
|
||||
import com.tokilabs.toki_socket.DialTcpTls
|
||||
import com.tokilabs.toki_socket.DialWs
|
||||
import com.tokilabs.toki_socket.DialWss
|
||||
import com.tokilabs.toki_socket.ParserMap
|
||||
import com.tokilabs.toki_socket.TcpClient
|
||||
import com.tokilabs.toki_socket.WsClient
|
||||
import com.tokilabs.toki_socket.addListenerTyped
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.toki_socket.sendRequestTyped
|
||||
import com.tokilabs.toki_socket.typeNameOf
|
||||
import com.tokilabs.proto_socket.Communicator
|
||||
import com.tokilabs.proto_socket.DialTcp
|
||||
import com.tokilabs.proto_socket.DialTcpTls
|
||||
import com.tokilabs.proto_socket.DialWs
|
||||
import com.tokilabs.proto_socket.DialWss
|
||||
import com.tokilabs.proto_socket.ParserMap
|
||||
import com.tokilabs.proto_socket.TcpClient
|
||||
import com.tokilabs.proto_socket.WsClient
|
||||
import com.tokilabs.proto_socket.addListenerTyped
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.sendRequestTyped
|
||||
import com.tokilabs.proto_socket.typeNameOf
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ dependencyResolutionManagement {
|
|||
}
|
||||
}
|
||||
|
||||
rootProject.name = "toki-socket-kotlin"
|
||||
rootProject.name = "proto-socket-kotlin"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.google.protobuf.Message
|
||||
import com.google.protobuf.MessageLite
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.toki_socket.packets.PacketBase
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.PacketBase
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.toki_socket.packets.PacketBase
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.PacketBase
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.google.protobuf.MessageLite
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.toki_socket.packets.PacketBase
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.PacketBase
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.google.protobuf.MessageLite
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
syntax = "proto3";
|
||||
|
||||
option java_package = "com.tokilabs.toki_socket.packets";
|
||||
option java_package = "com.tokilabs.proto_socket.packets";
|
||||
option java_outer_classname = "MessageCommonProto";
|
||||
option java_multiple_files = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.toki_socket.packets.PacketBase
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.PacketBase
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.HeartBeat
|
||||
import com.tokilabs.toki_socket.packets.PacketBase
|
||||
import com.tokilabs.proto_socket.packets.HeartBeat
|
||||
import com.tokilabs.proto_socket.packets.PacketBase
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.Collections
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.test.runTest
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
|
|
@ -28,7 +28,7 @@ class TcpTest {
|
|||
val client = DialTcp("127.0.0.1", port, 0, 0, testParserMap())
|
||||
|
||||
listenerReady.await()
|
||||
client.send(TestData.newBuilder().setIndex(42).setMessage("hello toki-socket").build())
|
||||
client.send(TestData.newBuilder().setIndex(42).setMessage("hello proto-socket").build())
|
||||
|
||||
assertEquals(42, received.await().index)
|
||||
client.close()
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import java.io.File
|
||||
import java.security.KeyFactory
|
||||
import java.security.KeyStore
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.nio.file.Paths
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tokilabs.toki_socket
|
||||
package com.tokilabs.proto_socket
|
||||
|
||||
import com.tokilabs.toki_socket.packets.TestData
|
||||
import com.tokilabs.proto_socket.packets.TestData
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
|
|
@ -26,7 +26,7 @@ class WsTest {
|
|||
val client = DialWs("127.0.0.1", port, "/", 0, 0, testParserMap())
|
||||
|
||||
listenerReady.await()
|
||||
client.send(TestData.newBuilder().setIndex(42).setMessage("hello toki-socket ws").build())
|
||||
client.send(TestData.newBuilder().setIndex(42).setMessage("hello proto-socket ws").build())
|
||||
|
||||
assertEquals(42, received.await().index)
|
||||
client.close()
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Toki Socket Python
|
||||
# Proto Socket Python
|
||||
|
||||
Python 3.11+ implementation of the Toki Socket protocol.
|
||||
Python 3.11+ implementation of the Proto Socket protocol.
|
||||
|
||||
## Supported Transports
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from toki_socket.ws_client import connect_ws, connect_wss
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from proto_socket.ws_client import connect_ws, connect_wss
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
WS_PATH = "/"
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from toki_socket.ws_client import connect_ws, connect_wss
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from proto_socket.ws_client import connect_ws, connect_wss
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
WS_PATH = "/"
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from toki_socket.ws_client import connect_ws, connect_wss
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from proto_socket.ws_client import connect_ws, connect_wss
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
WS_PATH = "/"
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PYTHON_DART_TCP_PORT = 29494
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PYTHON_GO_TCP_PORT = 29490
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PYTHON_KOTLIN_TCP_PORT = 29498
|
||||
|
|
@ -272,7 +272,7 @@ async def run_kotlin_client(
|
|||
process = await asyncio.create_subprocess_exec(
|
||||
"./gradlew",
|
||||
"run",
|
||||
f"-PmainClass=com.tokilabs.toki_socket.crosstest.PythonKotlinClientKt",
|
||||
f"-PmainClass=com.tokilabs.proto_socket.crosstest.PythonKotlinClientKt",
|
||||
f"--args={client_args}",
|
||||
cwd=kotlin_dir,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PYTHON_TYPESCRIPT_TCP_PORT = 29798
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from pathlib import Path
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData
|
||||
from toki_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from toki_socket.ws_client import connect_ws, connect_wss
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData
|
||||
from proto_socket.tcp_client import connect_tcp, connect_tcp_tls
|
||||
from proto_socket.ws_client import connect_ws, connect_wss
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
WS_PATH = "/"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
from toki_socket.base_client import BaseClient
|
||||
from toki_socket.communicator import (
|
||||
from proto_socket.base_client import BaseClient
|
||||
from proto_socket.communicator import (
|
||||
Communicator,
|
||||
NotConnectedError,
|
||||
ParserMap,
|
||||
Transport,
|
||||
type_name_of,
|
||||
)
|
||||
from toki_socket.tcp_client import MAX_PACKET_SIZE, TcpClient, connect_tcp, connect_tcp_tls
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from toki_socket.ws_client import WsClient, connect_ws, connect_wss
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.tcp_client import MAX_PACKET_SIZE, TcpClient, connect_tcp, connect_tcp_tls
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
from proto_socket.ws_client import WsClient, connect_ws, connect_wss
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
__all__ = [
|
||||
"BaseClient",
|
||||
|
|
@ -6,8 +6,8 @@ from collections.abc import Awaitable, Callable
|
|||
from contextlib import suppress
|
||||
from typing import Any
|
||||
|
||||
from toki_socket.communicator import Communicator
|
||||
from toki_socket.packets.message_common_pb2 import HeartBeat
|
||||
from proto_socket.communicator import Communicator
|
||||
from proto_socket.packets.message_common_pb2 import HeartBeat
|
||||
|
||||
|
||||
class _HbTimer:
|
||||
|
|
@ -7,7 +7,7 @@ from typing import Any, Protocol, TypeAlias, TypeVar, runtime_checkable
|
|||
|
||||
from google.protobuf.message import Message
|
||||
|
||||
from toki_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
from proto_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
|
||||
T = TypeVar("T", bound=Message)
|
||||
ParserMap: TypeAlias = dict[str, Callable[[bytes], Message]]
|
||||
4
python/proto_socket/packets/__init__.py
Normal file
4
python/proto_socket/packets/__init__.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from proto_socket.packets.message_common_pb2 import HeartBeat, PacketBase, TestData
|
||||
|
||||
__all__ = ["HeartBeat", "PacketBase", "TestData"]
|
||||
|
||||
|
|
@ -7,9 +7,9 @@ from contextlib import suppress
|
|||
|
||||
from google.protobuf.message import DecodeError
|
||||
|
||||
from toki_socket.base_client import BaseClient
|
||||
from toki_socket.communicator import ParserMap, type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
from proto_socket.base_client import BaseClient
|
||||
from proto_socket.communicator import ParserMap, type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
|
||||
MAX_PACKET_SIZE = 64 << 20
|
||||
|
||||
|
|
@ -7,8 +7,8 @@ from collections.abc import Callable
|
|||
|
||||
from google.protobuf.message import Message
|
||||
|
||||
from toki_socket.communicator import ParserMap
|
||||
from toki_socket.tcp_client import TcpClient
|
||||
from proto_socket.communicator import ParserMap
|
||||
from proto_socket.tcp_client import TcpClient
|
||||
|
||||
|
||||
class TcpServer:
|
||||
|
|
@ -13,9 +13,9 @@ try:
|
|||
except ImportError: # websockets 12.x legacy API
|
||||
from websockets import connect as ws_connect
|
||||
|
||||
from toki_socket.base_client import BaseClient
|
||||
from toki_socket.communicator import ParserMap, type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
from proto_socket.base_client import BaseClient
|
||||
from proto_socket.communicator import ParserMap, type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import HeartBeat, PacketBase
|
||||
|
||||
|
||||
class WsClient(BaseClient):
|
||||
|
|
@ -16,8 +16,8 @@ except ImportError: # websockets 12.x legacy API
|
|||
|
||||
_NEW_WEBSOCKETS_API = False
|
||||
|
||||
from toki_socket.communicator import ParserMap
|
||||
from toki_socket.ws_client import WsClient
|
||||
from proto_socket.communicator import ParserMap
|
||||
from proto_socket.ws_client import WsClient
|
||||
|
||||
|
||||
class WsServer:
|
||||
|
|
@ -3,9 +3,9 @@ requires = ["setuptools>=68"]
|
|||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "toki-socket"
|
||||
name = "proto-socket"
|
||||
version = "1.0.5"
|
||||
description = "Python implementation of the Toki Socket binary socket protocol."
|
||||
description = "Python implementation of the Proto Socket binary socket protocol."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
|
@ -21,7 +21,7 @@ dev = [
|
|||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["toki_socket*"]
|
||||
include = ["proto_socket*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"toki_socket.packets" = ["*.proto", "*.pyi"]
|
||||
"proto_socket.packets" = ["*.proto", "*.pyi"]
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import asyncio
|
|||
|
||||
import pytest
|
||||
|
||||
from toki_socket.communicator import MAX_NONCE, Communicator, type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import PacketBase, TestData as ProtoTestData
|
||||
from proto_socket.communicator import MAX_NONCE, Communicator, type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import PacketBase, TestData as ProtoTestData
|
||||
|
||||
|
||||
class FakeTransport:
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData as ProtoTestData
|
||||
from toki_socket.tcp_client import TcpClient, connect_tcp, connect_tcp_tls
|
||||
from toki_socket.tcp_server import TcpServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData as ProtoTestData
|
||||
from proto_socket.tcp_client import TcpClient, connect_tcp, connect_tcp_tls
|
||||
from proto_socket.tcp_server import TcpServer
|
||||
|
||||
|
||||
def _make_server_ssl_context() -> ssl.SSLContext:
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
|
||||
from toki_socket.communicator import type_name_of
|
||||
from toki_socket.packets.message_common_pb2 import TestData as ProtoTestData
|
||||
from toki_socket.ws_client import WsClient, connect_ws, connect_wss
|
||||
from toki_socket.ws_server import WsServer
|
||||
from proto_socket.communicator import type_name_of
|
||||
from proto_socket.packets.message_common_pb2 import TestData as ProtoTestData
|
||||
from proto_socket.ws_client import WsClient, connect_ws, connect_wss
|
||||
from proto_socket.ws_server import WsServer
|
||||
|
||||
|
||||
def _make_server_ssl_context() -> ssl.SSLContext:
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
from toki_socket.packets.message_common_pb2 import HeartBeat, PacketBase, TestData
|
||||
|
||||
__all__ = ["HeartBeat", "PacketBase", "TestData"]
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# TypeScript Toki Socket
|
||||
# TypeScript Proto Socket
|
||||
|
||||
Status: planned
|
||||
|
||||
This package implements Toki Socket protocol version `0.1` for TypeScript.
|
||||
This package implements Proto Socket protocol version `0.1` for TypeScript.
|
||||
|
||||
## Scope
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ async function runKotlinClient(
|
|||
"./gradlew",
|
||||
[
|
||||
"run",
|
||||
"-PmainClass=com.tokilabs.toki_socket.crosstest.TypescriptKotlinClientKt",
|
||||
"-PmainClass=com.tokilabs.proto_socket.crosstest.TypescriptKotlinClientKt",
|
||||
`--args=${clientArgs}`,
|
||||
],
|
||||
kotlinDir,
|
||||
|
|
|
|||
4
typescript/package-lock.json
generated
4
typescript/package-lock.json
generated
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "toki-socket",
|
||||
"name": "proto-socket",
|
||||
"version": "1.0.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "toki-socket",
|
||||
"name": "proto-socket",
|
||||
"version": "1.0.5",
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.2.5",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "toki-socket",
|
||||
"name": "proto-socket",
|
||||
"version": "1.0.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
|
|
|||
Loading…
Reference in a new issue