├── .gitignore ├── 4.2.0.VERSION ├── LICENSE ├── README.md ├── cim-boot-server ├── .gitignore ├── README.txt ├── init.sql ├── jar.bat ├── jar.sh ├── pom.xml ├── run.bat ├── run.sh └── src │ └── main │ ├── java │ └── com │ │ └── farsunset │ │ └── cim │ │ ├── BootApplication.java │ │ ├── annotation │ │ ├── AccessToken.java │ │ ├── CreateAction.java │ │ └── UID.java │ │ ├── component │ │ ├── event │ │ │ ├── MessageEvent.java │ │ │ └── SessionEvent.java │ │ ├── handler │ │ │ ├── BindHandler.java │ │ │ ├── ClosedHandler.java │ │ │ └── annotation │ │ │ │ └── CIMHandler.java │ │ ├── message │ │ │ ├── BindMessageListener.java │ │ │ └── PushMessageListener.java │ │ ├── predicate │ │ │ └── HandshakePredicate.java │ │ ├── push │ │ │ ├── CIMMessagePusher.java │ │ │ └── DefaultMessagePusher.java │ │ └── redis │ │ │ ├── KeyValueRedisTemplate.java │ │ │ ├── SignalRedisTemplate.java │ │ │ └── TokenRedisTemplate.java │ │ ├── config │ │ ├── CIMConfig.java │ │ ├── MvcConfig.java │ │ ├── RedisConfig.java │ │ ├── SwaggerConfig.java │ │ └── properties │ │ │ ├── APNsProperties.java │ │ │ ├── CIMAppSocketProperties.java │ │ │ └── CIMWebsocketProperties.java │ │ ├── constants │ │ ├── Constants.java │ │ └── MessageAction.java │ │ ├── entity │ │ └── Session.java │ │ ├── mvc │ │ ├── controller │ │ │ ├── admin │ │ │ │ ├── NavigationController.java │ │ │ │ └── SessionController.java │ │ │ └── api │ │ │ │ ├── APNsController.java │ │ │ │ ├── MessageController.java │ │ │ │ ├── UserController.java │ │ │ │ └── WebrtcController.java │ │ ├── interceptor │ │ │ └── TokenInterceptor.java │ │ ├── request │ │ │ └── WebrtcRequest.java │ │ ├── resolver │ │ │ ├── TokenArgumentResolver.java │ │ │ └── UidArgumentResolver.java │ │ └── response │ │ │ └── ResponseEntity.java │ │ ├── repository │ │ └── SessionRepository.java │ │ ├── service │ │ ├── AccessTokenService.java │ │ ├── ApnsService.java │ │ ├── SessionService.java │ │ └── impl │ │ │ ├── APNsServiceImpl.java │ │ │ ├── AccessTokenServiceImpl.java │ │ │ └── SessionServiceImpl.java │ │ └── util │ │ └── JSONUtils.java │ └── resources │ ├── apns │ └── app.p12 │ ├── application.properties │ ├── i18n │ └── messages.properties │ ├── logback-spring.xml │ ├── page │ ├── console │ │ ├── header.html │ │ ├── index.html │ │ ├── nav.html │ │ ├── session │ │ │ └── manage.html │ │ └── webclient │ │ │ └── index.html │ └── ftl │ │ └── spring.ftl │ └── static │ ├── bootstrap-3.3.7-dist │ ├── css │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ ├── bootstrap.min.js │ │ └── npm.js │ ├── css │ └── common.css │ ├── image │ ├── favicon.ico │ ├── icon.png │ ├── icon │ │ └── online.svg │ ├── icon_loading_small.gif │ ├── logo.svg │ └── pattern.png │ └── js │ ├── cim │ ├── cim.web.sdk.js │ ├── message.js │ ├── replybody.js │ └── sentbody.js │ ├── common.js │ ├── jquery-3.3.1.min.js │ └── jquery-ui.min.js ├── cim-client-sdk ├── .idea │ ├── cim-client-sdk.iml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── cim-android-sdk │ ├── .gitignore │ ├── jar.bat │ ├── jar.sh │ ├── libs │ │ └── android.jar │ ├── pom.xml │ ├── release.sh │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── farsunset │ │ └── cim │ │ └── sdk │ │ └── android │ │ ├── CIMCacheManager.java │ │ ├── CIMCacheProvider.java │ │ ├── CIMConnectManager.java │ │ ├── CIMEventBroadcastReceiver.java │ │ ├── CIMEventListener.java │ │ ├── CIMListenerManager.java │ │ ├── CIMPushManager.java │ │ ├── CIMPushService.java │ │ ├── coder │ │ ├── ClientMessageDecoder.java │ │ └── ClientMessageEncoder.java │ │ ├── constant │ │ ├── BundleKey.java │ │ ├── CIMConstant.java │ │ ├── IntentAction.java │ │ ├── ProtobufType.java │ │ ├── RequestKey.java │ │ └── ServiceAction.java │ │ ├── logger │ │ └── CIMLogger.java │ │ └── model │ │ ├── BinaryBody.java │ │ ├── Message.java │ │ ├── Ping.java │ │ ├── Pong.java │ │ ├── ReplyBody.java │ │ ├── SentBody.java │ │ └── proto │ │ ├── Message.proto │ │ ├── MessageProto.java │ │ ├── ReplyBody.proto │ │ ├── ReplyBodyProto.java │ │ ├── SentBody.proto │ │ └── SentBodyProto.java ├── cim-dotnet-sdk │ ├── .vs │ │ └── CIM_SDK │ │ │ ├── DesignTimeBuild │ │ │ └── .dtbcache.v2 │ │ │ └── v16 │ │ │ └── .suo │ ├── CIM_SDK.sln │ ├── CIM_SDK_Tests │ │ ├── CIM_SDK_Tests.csproj │ │ ├── Program.cs │ │ ├── bin │ │ │ └── Debug │ │ │ │ └── netcoreapp3.1 │ │ │ │ ├── CIM_SDK_Tests.deps.json │ │ │ │ ├── CIM_SDK_Tests.dll │ │ │ │ ├── CIM_SDK_Tests.exe │ │ │ │ ├── CIM_SDK_Tests.pdb │ │ │ │ ├── CIM_SDK_Tests.runtimeconfig.dev.json │ │ │ │ ├── CIM_SDK_Tests.runtimeconfig.json │ │ │ │ ├── CIM_Standard.dll │ │ │ │ ├── CIM_Standard.pdb │ │ │ │ └── Google.Protobuf.dll │ │ └── obj │ │ │ ├── CIM_SDK_Tests.csproj.nuget.dgspec.json │ │ │ ├── CIM_SDK_Tests.csproj.nuget.g.props │ │ │ ├── CIM_SDK_Tests.csproj.nuget.g.targets │ │ │ ├── Debug │ │ │ └── netcoreapp3.1 │ │ │ │ ├── .NETCoreApp,Version=v3.1.AssemblyAttributes.cs │ │ │ │ ├── CIM_SDK_Tests.AssemblyInfo.cs │ │ │ │ ├── CIM_SDK_Tests.AssemblyInfoInputs.cache │ │ │ │ ├── CIM_SDK_Tests.assets.cache │ │ │ │ ├── CIM_SDK_Tests.csproj.AssemblyReference.cache │ │ │ │ ├── CIM_SDK_Tests.csproj.CopyComplete │ │ │ │ ├── CIM_SDK_Tests.csproj.CoreCompileInputs.cache │ │ │ │ ├── CIM_SDK_Tests.csproj.FileListAbsolute.txt │ │ │ │ ├── CIM_SDK_Tests.csprojAssemblyReference.cache │ │ │ │ ├── CIM_SDK_Tests.dll │ │ │ │ ├── CIM_SDK_Tests.genruntimeconfig.cache │ │ │ │ ├── CIM_SDK_Tests.pdb │ │ │ │ └── apphost.exe │ │ │ ├── project.assets.json │ │ │ └── project.nuget.cache │ ├── CIM_Standard │ │ ├── CIM_Standard.csproj │ │ ├── Protobuf │ │ │ ├── Message.cs │ │ │ ├── ReplyBody.cs │ │ │ └── SentBody.cs │ │ ├── SocketHelper.cs │ │ ├── bin │ │ │ └── Debug │ │ │ │ └── netstandard2.0 │ │ │ │ ├── CIM_Standard.deps.json │ │ │ │ ├── CIM_Standard.dll │ │ │ │ └── CIM_Standard.pdb │ │ └── obj │ │ │ ├── CIM_Standard.csproj.nuget.dgspec.json │ │ │ ├── CIM_Standard.csproj.nuget.g.props │ │ │ ├── CIM_Standard.csproj.nuget.g.targets │ │ │ ├── Debug │ │ │ └── netstandard2.0 │ │ │ │ ├── .NETStandard,Version=v2.0.AssemblyAttributes.cs │ │ │ │ ├── CIM_Standard.AssemblyInfo.cs │ │ │ │ ├── CIM_Standard.AssemblyInfoInputs.cache │ │ │ │ ├── CIM_Standard.assets.cache │ │ │ │ ├── CIM_Standard.csproj.AssemblyReference.cache │ │ │ │ ├── CIM_Standard.csproj.CoreCompileInputs.cache │ │ │ │ ├── CIM_Standard.csproj.FileListAbsolute.txt │ │ │ │ ├── CIM_Standard.csprojAssemblyReference.cache │ │ │ │ ├── CIM_Standard.dll │ │ │ │ └── CIM_Standard.pdb │ │ │ ├── project.assets.json │ │ │ └── project.nuget.cache │ └── 使用说明.txt ├── cim-flutter-sdk │ ├── cim-boot-client.dart │ └── protobuf │ │ ├── Message.pb.dart │ │ ├── Message.pbenum.dart │ │ ├── Message.pbjson.dart │ │ ├── Message.pbserver.dart │ │ ├── Message.proto │ │ ├── ReplyBody.pb.dart │ │ ├── ReplyBody.pbenum.dart │ │ ├── ReplyBody.pbjson.dart │ │ ├── ReplyBody.pbserver.dart │ │ ├── ReplyBody.proto │ │ ├── SentBody.pb.dart │ │ ├── SentBody.pbenum.dart │ │ ├── SentBody.pbjson.dart │ │ ├── SentBody.pbserver.dart │ │ └── SentBody.proto ├── cim-ios-oc-sdk │ └── README.txt ├── cim-swift-sdk │ ├── .gitignore │ ├── CIMClient │ │ ├── .gitignore │ │ ├── .swiftpm │ │ │ └── xcode │ │ │ │ └── package.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Package.swift │ │ ├── README.md │ │ ├── Sources │ │ │ └── CIMClient │ │ │ │ ├── Coder │ │ │ │ ├── WebMessageDecoder.swift │ │ │ │ └── WebMessageEncoder.swift │ │ │ │ ├── Constant │ │ │ │ ├── CIMError.swift │ │ │ │ └── Constant.swift │ │ │ │ ├── Core │ │ │ │ ├── CIMClient.swift │ │ │ │ ├── MessageSender.swift │ │ │ │ └── WebsocketClient.swift │ │ │ │ ├── DB │ │ │ │ ├── CIMDBManager.swift │ │ │ │ └── MessageDB.swift │ │ │ │ ├── Extension │ │ │ │ └── Date+Extension.swift │ │ │ │ ├── MessageInterceptor │ │ │ │ ├── AutoReConnectInterceptor.swift │ │ │ │ ├── ConnectListener.swift │ │ │ │ ├── HeartInterceptor.swift │ │ │ │ ├── MessageDatabaseInterceptor.swift │ │ │ │ ├── MessageInterceptor.swift │ │ │ │ ├── MessageListener.swift │ │ │ │ └── MessageLogInterceptor.swift │ │ │ │ └── Model │ │ │ │ ├── Account.swift │ │ │ │ ├── Message.swift │ │ │ │ ├── MessageBuilder.swift │ │ │ │ ├── Ping.swift │ │ │ │ ├── Pong.swift │ │ │ │ ├── ReplyBody.swift │ │ │ │ ├── SentBody.swift │ │ │ │ ├── Transportable.swift │ │ │ │ └── proto │ │ │ │ ├── MessageProto.pb.swift │ │ │ │ ├── ReplyBodyProto.pb.swift │ │ │ │ └── SentBodyProto.pb.swift │ │ └── Tests │ │ │ └── CIMClientTests │ │ │ └── CIMClientTests.swift │ ├── Demo │ │ ├── Shared │ │ │ ├── Assets.xcassets │ │ │ │ ├── AccentColor.colorset │ │ │ │ │ └── Contents.json │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ │ ├── Contents.json │ │ │ │ └── avatar.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ └── avatar.jpg │ │ │ ├── CIMAppApp.swift │ │ │ ├── ContentView.swift │ │ │ └── IMClient.swift │ │ └── macOS │ │ │ ├── ContentView.swift │ │ │ ├── Extension.swift │ │ │ ├── Model │ │ │ ├── Session.swift │ │ │ └── User.swift │ │ │ ├── View │ │ │ ├── AllChatsView.swift │ │ │ ├── BlurView.swift │ │ │ ├── DetailView.swift │ │ │ ├── Home.swift │ │ │ ├── RecentCardView.swift │ │ │ └── TabButton.swift │ │ │ ├── ViewModel │ │ │ └── HomeViewModel.swift │ │ │ └── macOS.entitlements │ ├── Package.swift │ ├── README.md │ ├── proto │ │ ├── MessageProto.proto │ │ ├── ReplyBodyProto.proto │ │ ├── SentBodyProto.proto │ │ └── translate.sh │ └── screenshot │ │ └── macOS.png └── cim-web-sdk │ ├── cim.web.sdk.js │ ├── message.js │ ├── replybody.js │ └── sentbody.js ├── cim-server-sdk ├── .gitignore ├── jar.bat ├── jar.sh ├── pom.xml ├── release.sh └── src │ └── main │ └── java │ └── com │ └── farsunset │ └── cim │ ├── acceptor │ ├── AppSocketAcceptor.java │ ├── NioSocketAcceptor.java │ ├── WebsocketAcceptor.java │ └── config │ │ ├── SocketConfig.java │ │ └── WebsocketConfig.java │ ├── coder │ ├── json │ │ ├── TextMessageDecoder.java │ │ ├── TextMessageEncoder.java │ │ └── TransmitBody.java │ └── protobuf │ │ ├── AppMessageDecoder.java │ │ ├── AppMessageEncoder.java │ │ ├── WebMessageDecoder.java │ │ └── WebMessageEncoder.java │ ├── constant │ ├── CIMConstant.java │ ├── ChannelAttr.java │ ├── DataType.java │ └── WebsocketProtocol.java │ ├── exception │ └── ReadInvalidTypeException.java │ ├── group │ ├── SessionGroup.java │ └── TagSessionGroup.java │ ├── handler │ ├── CIMRequestHandler.java │ ├── IllegalRequestHandler.java │ └── LoggingHandler.java │ ├── handshake │ ├── HandshakeEvent.java │ └── HandshakeHandler.java │ └── model │ ├── Message.java │ ├── Ping.java │ ├── Pong.java │ ├── ReplyBody.java │ ├── SentBody.java │ ├── Transportable.java │ └── proto │ ├── Message.proto │ ├── MessageProto.java │ ├── ReplyBody.proto │ ├── ReplyBodyProto.java │ ├── SentBody.proto │ └── SentBodyProto.java ├── cim-use-examples ├── cim-client-android │ ├── .gitignore │ ├── .idea │ │ ├── gradle.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── vcs.xml │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── farsunset │ │ │ │ └── cim │ │ │ │ ├── activity │ │ │ │ ├── LoginActivity.java │ │ │ │ └── MessageActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── MessageListAdapter.java │ │ │ │ └── holder │ │ │ │ │ └── MessageViewHolder.java │ │ │ │ ├── app │ │ │ │ └── CIMApplication.java │ │ │ │ ├── data │ │ │ │ ├── LoginDataSource.java │ │ │ │ ├── LoginRepository.java │ │ │ │ ├── Result.java │ │ │ │ └── model │ │ │ │ │ └── LoggedInUser.java │ │ │ │ ├── dialog │ │ │ │ └── SendMessageDialog.java │ │ │ │ ├── http │ │ │ │ ├── MessageService.java │ │ │ │ └── SendMessageManager.java │ │ │ │ ├── reveiver │ │ │ │ └── CIMPushMessageReceiver.java │ │ │ │ └── widget │ │ │ │ ├── ColorBallView.java │ │ │ │ ├── MeteorWallpaperView.java │ │ │ │ └── RainbowBallView.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── app_login_bg_compat.xml │ │ │ ├── dialog_edit_background.xml │ │ │ ├── dialog_material_background.xml │ │ │ ├── edit_background_corners.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── icon_menu_send.xml │ │ │ └── login_content_background.xml │ │ │ ├── layout │ │ │ ├── activity_login.xml │ │ │ ├── activity_message.xml │ │ │ ├── dialog_send_message.xml │ │ │ └── item_message.xml │ │ │ ├── menu │ │ │ └── send.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── app_splash_background.jpg │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── themes.xml │ │ │ └── xml │ │ │ └── network_security_config.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── cim-client-vue │ ├── Auto.vue │ ├── README.txt │ └── websocket │ │ ├── cim.web.sdk.js │ │ ├── message.js │ │ ├── replybody.js │ │ └── sentbody.js ├── cim-client-web-json │ ├── README.txt │ ├── css │ │ ├── bootstrap.min.css │ │ └── common.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── image │ │ ├── icon.png │ │ ├── icon_loading_small.gif │ │ └── pattern.png │ ├── index.html │ └── js │ │ ├── bootstrap.min.js │ │ ├── cim │ │ └── cim.web.sdk.js │ │ ├── common.js │ │ └── jquery-3.3.1.min.js └── cim-client-web-protobuf │ ├── README.txt │ ├── css │ ├── bootstrap.min.css │ └── common.css │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 │ ├── image │ ├── icon.png │ ├── icon_loading_small.gif │ └── pattern.png │ ├── index.html │ └── js │ ├── bootstrap.min.js │ ├── cim │ ├── cim.web.sdk.js │ ├── message.js │ ├── replybody.js │ └── sentbody.js │ ├── common.js │ └── jquery-3.3.1.min.js └── doc ├── proto ├── c#.zip ├── c# │ ├── Message.cs │ ├── Message.proto │ ├── ReplyBody.cs │ ├── ReplyBody.proto │ ├── SentBody.cs │ └── SentBody.proto ├── c++.zip ├── c++ │ ├── Message.pb.cc │ ├── Message.pb.h │ ├── Message.proto │ ├── ReplyBody.pb.cc │ ├── ReplyBody.pb.h │ ├── ReplyBody.proto │ ├── SentBody.pb.cc │ ├── SentBody.pb.h │ └── SentBody.proto ├── js │ ├── Message.proto │ ├── ReplyBody.proto │ ├── SentBody.proto │ ├── message.js │ ├── replybody.js │ ├── sentbody.js │ └── 说明.txt ├── objective-c.zip ├── objective-c │ ├── Message.pbobjc.h │ ├── Message.pbobjc.m │ ├── Message.proto │ ├── ReplyBody.pbobjc.h │ ├── ReplyBody.pbobjc.m │ ├── ReplyBody.proto │ ├── SentBody.pbobjc.h │ ├── SentBody.pbobjc.m │ └── SentBody.proto ├── other.zip ├── other │ ├── Message.proto │ ├── ReplyBody.proto │ ├── SentBody.proto │ └── 说明.txt ├── python.zip └── python │ ├── Message.proto │ ├── Message_pb2.py │ ├── ReplyBody.proto │ ├── ReplyBody_pb2.py │ ├── SentBody.proto │ └── SentBody_pb2.py └── 在线文档.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | /target/ 25 | /.idea/ 26 | *.class 27 | */local.properties -------------------------------------------------------------------------------- /4.2.0.VERSION: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/4.2.0.VERSION -------------------------------------------------------------------------------- /cim-boot-server/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .idea/ -------------------------------------------------------------------------------- /cim-boot-server/README.txt: -------------------------------------------------------------------------------- 1 | 如果你不想搭建服务端也可以使用,公共的服务器做测试喔 2 | 具体信息参见:https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#yC5Vq 3 | -------------------------------------------------------------------------------- /cim-boot-server/init.sql: -------------------------------------------------------------------------------- 1 | create database cim; 2 | 3 | #只需要创建库即可,服务器启动会自动创建表,基于application.properties中 4 | #spring.jpa.hibernate.ddl-auto = update 5 | -------------------------------------------------------------------------------- /cim-boot-server/jar.bat: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-boot-server/jar.sh: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-boot-server/run.bat: -------------------------------------------------------------------------------- 1 | java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./cim-boot-server-4.2.0.jar -------------------------------------------------------------------------------- /cim-boot-server/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=dev -Dserver.port=9090 -jar ./cim-boot-server-4.2.0.jar & -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/BootApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim; 23 | 24 | import org.springframework.boot.SpringApplication; 25 | import org.springframework.boot.autoconfigure.SpringBootApplication; 26 | 27 | @SpringBootApplication 28 | public class BootApplication { 29 | public static void main(String[] args) { 30 | SpringApplication.run(BootApplication.class, args); 31 | } 32 | } -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/annotation/AccessToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.annotation; 23 | 24 | import java.lang.annotation.ElementType; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | import java.lang.annotation.Target; 28 | 29 | /** 30 | * 用户标注通过 token查到的用户账号,注入到Controller参数里面 31 | */ 32 | @Target(ElementType.PARAMETER) 33 | @Retention(RetentionPolicy.RUNTIME) 34 | public @interface AccessToken { 35 | } 36 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/annotation/CreateAction.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.annotation; 2 | 3 | public @interface CreateAction { 4 | } 5 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/annotation/UID.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.annotation; 23 | 24 | import java.lang.annotation.ElementType; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | import java.lang.annotation.Target; 28 | 29 | /** 30 | * 用户标注通过 token查到的用户账号,注入到Controller参数里面 31 | */ 32 | @Target(ElementType.PARAMETER) 33 | @Retention(RetentionPolicy.RUNTIME) 34 | public @interface UID { 35 | } 36 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/event/MessageEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.event; 23 | 24 | import com.farsunset.cim.model.Message; 25 | import org.springframework.context.ApplicationEvent; 26 | 27 | public class MessageEvent extends ApplicationEvent { 28 | public MessageEvent(Message message) { 29 | super(message); 30 | } 31 | 32 | @Override 33 | public Message getSource() { 34 | return (Message) source; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/event/SessionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.event; 23 | 24 | import com.farsunset.cim.entity.Session; 25 | import org.springframework.context.ApplicationEvent; 26 | 27 | public class SessionEvent extends ApplicationEvent { 28 | public SessionEvent(Session session) { 29 | super(session); 30 | } 31 | 32 | @Override 33 | public Session getSource() { 34 | return (Session) source; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/handler/annotation/CIMHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.handler.annotation; 23 | 24 | import org.springframework.stereotype.Component; 25 | 26 | import java.lang.annotation.*; 27 | 28 | @Target({ElementType.TYPE}) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | @Component 32 | 33 | public @interface CIMHandler { 34 | String key(); 35 | } 36 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/predicate/HandshakePredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.predicate; 23 | 24 | import com.farsunset.cim.handshake.HandshakeEvent; 25 | import org.springframework.stereotype.Component; 26 | 27 | import java.util.function.Predicate; 28 | 29 | 30 | /** 31 | * WS链接握手鉴权验证 32 | */ 33 | @Component 34 | public class HandshakePredicate implements Predicate { 35 | 36 | /** 37 | * 验证身份信息,本方法切勿进行耗时操作!!! 38 | * @param event 39 | * @return true验证通过 false验证失败 40 | */ 41 | @Override 42 | public boolean test(HandshakeEvent event) { 43 | 44 | /* 45 | 可通过header或者uri传递参数 46 | String token = event.getHeader("token"); 47 | String token = event.getParameter("token"); 48 | do auth.... 49 | */ 50 | 51 | return true; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/push/CIMMessagePusher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.push; 23 | 24 | 25 | import com.farsunset.cim.model.Message; 26 | 27 | /* 28 | * 消息发送实接口 29 | * 30 | */ 31 | public interface CIMMessagePusher { 32 | 33 | /* 34 | * 向用户发送消息 35 | * 36 | * @param msg 37 | */ 38 | void push(Message msg); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/component/redis/TokenRedisTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.component.redis; 23 | 24 | import org.springframework.data.redis.connection.RedisConnectionFactory; 25 | import org.springframework.data.redis.core.StringRedisTemplate; 26 | import org.springframework.stereotype.Component; 27 | 28 | @Component 29 | public class TokenRedisTemplate extends StringRedisTemplate { 30 | 31 | private static final String TOKEN_CACHE_PREFIX = "TOKEN_%s"; 32 | 33 | 34 | public TokenRedisTemplate(RedisConnectionFactory connectionFactory) { 35 | super(connectionFactory); 36 | } 37 | 38 | public void save(String token, String uid) { 39 | 40 | String key = String.format(TOKEN_CACHE_PREFIX,token); 41 | 42 | super.boundValueOps(key).set(uid); 43 | } 44 | 45 | public String get(String token) { 46 | 47 | String key = String.format(TOKEN_CACHE_PREFIX,token); 48 | 49 | return super.boundValueOps(key).get(); 50 | 51 | } 52 | 53 | public void remove(String token) { 54 | 55 | String key = String.format(TOKEN_CACHE_PREFIX,token); 56 | 57 | super.delete(key); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/constants/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.constants; 23 | 24 | import io.netty.util.AttributeKey; 25 | 26 | public interface Constants { 27 | 28 | String PUSH_MESSAGE_INNER_QUEUE = "signal/channel/PUSH_MESSAGE_INNER_QUEUE"; 29 | 30 | String BIND_MESSAGE_INNER_QUEUE = "signal/channel/BIND_MESSAGE_INNER_QUEUE"; 31 | 32 | String APNS_DEVICE_TOKEN = "APNS_OPEN_%s"; 33 | 34 | AttributeKey SESSION_ID = AttributeKey.valueOf("session_id"); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/NavigationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.mvc.controller.admin; 23 | 24 | import org.springframework.stereotype.Controller; 25 | import org.springframework.web.bind.annotation.GetMapping; 26 | import org.springframework.web.servlet.ModelAndView; 27 | 28 | @Controller 29 | public class NavigationController { 30 | 31 | @GetMapping(value = "/") 32 | public ModelAndView index(ModelAndView model) { 33 | model.setViewName("console/index"); 34 | return model; 35 | } 36 | 37 | @GetMapping(value = "/webclient") 38 | public ModelAndView webclient(ModelAndView model) { 39 | model.setViewName("console/webclient/index"); 40 | return model; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/SessionController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.mvc.controller.admin; 23 | 24 | import com.farsunset.cim.service.SessionService; 25 | import org.springframework.stereotype.Controller; 26 | import org.springframework.ui.Model; 27 | import org.springframework.web.bind.annotation.GetMapping; 28 | import org.springframework.web.bind.annotation.RequestMapping; 29 | 30 | import javax.annotation.Resource; 31 | 32 | @Controller 33 | @RequestMapping("/console/session") 34 | public class SessionController { 35 | 36 | @Resource 37 | private SessionService sessionService; 38 | 39 | @GetMapping(value = "/list") 40 | public String list(Model model) { 41 | model.addAttribute("sessionList", sessionService.findAll()); 42 | return "console/session/manage"; 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/mvc/request/WebrtcRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.mvc.request; 23 | 24 | import com.farsunset.cim.annotation.CreateAction; 25 | import io.swagger.annotations.ApiModel; 26 | import io.swagger.annotations.ApiModelProperty; 27 | 28 | import javax.validation.constraints.NotEmpty; 29 | import javax.validation.constraints.NotNull; 30 | import java.io.Serializable; 31 | 32 | @ApiModel("单人通话ice、offer、answer同步请求体") 33 | public class WebrtcRequest implements Serializable { 34 | 35 | @NotNull(message = "UID不能为空",groups = CreateAction.class) 36 | @ApiModelProperty("对方UID") 37 | private String uid; 38 | 39 | @NotEmpty(message = "content不能超过2000个字符",groups = CreateAction.class) 40 | @ApiModelProperty("ice信息json、offer或者answer的sdp") 41 | private String content; 42 | 43 | public String getUid() { 44 | return uid; 45 | } 46 | 47 | public void setUid(String uid) { 48 | this.uid = uid; 49 | } 50 | 51 | public String getContent() { 52 | return content; 53 | } 54 | 55 | public void setContent(String content) { 56 | this.content = content; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/mvc/resolver/UidArgumentResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.mvc.resolver; 23 | 24 | import com.farsunset.cim.annotation.UID; 25 | import org.springframework.core.MethodParameter; 26 | import org.springframework.web.bind.support.WebDataBinderFactory; 27 | import org.springframework.web.context.request.NativeWebRequest; 28 | import org.springframework.web.context.request.RequestAttributes; 29 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 30 | import org.springframework.web.method.support.ModelAndViewContainer; 31 | 32 | public class UidArgumentResolver implements HandlerMethodArgumentResolver { 33 | 34 | @Override 35 | public boolean supportsParameter(MethodParameter parameter) { 36 | return parameter.hasParameterAnnotation(UID.class); 37 | } 38 | 39 | @Override 40 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, 41 | NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { 42 | return webRequest.getAttribute(UID.class.getName(),RequestAttributes.SCOPE_REQUEST); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/service/AccessTokenService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.service; 23 | 24 | 25 | public interface AccessTokenService { 26 | 27 | String generate(String uid); 28 | 29 | String getUid(String token); 30 | 31 | void delete(String value); 32 | } 33 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/service/ApnsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.service; 23 | 24 | 25 | import com.farsunset.cim.model.Message; 26 | 27 | public interface APNsService { 28 | 29 | void push(Message message, String deviceToken); 30 | } 31 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/service/SessionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.service; 23 | 24 | 25 | import com.farsunset.cim.entity.Session; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * 存储连接信息,便于查看用户的链接信息 31 | */ 32 | public interface SessionService { 33 | 34 | void add(Session session); 35 | 36 | void delete(long id); 37 | 38 | /** 39 | * 删除本机的连接记录 40 | */ 41 | void deleteLocalhost(); 42 | 43 | void updateState(long id,int state); 44 | 45 | void openApns(String uid,String deviceToken); 46 | 47 | void closeApns(String uid); 48 | 49 | List findAll(); 50 | } 51 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/java/com/farsunset/cim/service/impl/AccessTokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.service.impl; 23 | 24 | import com.farsunset.cim.component.redis.TokenRedisTemplate; 25 | import com.farsunset.cim.service.AccessTokenService; 26 | import org.apache.commons.lang3.StringUtils; 27 | import org.springframework.stereotype.Service; 28 | 29 | import javax.annotation.Resource; 30 | import java.util.UUID; 31 | 32 | @Service 33 | public class AccessTokenServiceImpl implements AccessTokenService { 34 | @Resource 35 | private TokenRedisTemplate tokenRedisTemplate; 36 | 37 | @Override 38 | public String getUid(String token) { 39 | if (StringUtils.isBlank(token)){ 40 | return null; 41 | } 42 | return tokenRedisTemplate.get(token); 43 | } 44 | 45 | @Override 46 | public void delete(String token) { 47 | tokenRedisTemplate.delete(token); 48 | } 49 | 50 | /** 51 | * 方便调试,这里生成token为永不过期 52 | * @param uid 53 | * @return 54 | */ 55 | @Override 56 | public String generate(String uid) { 57 | String newToken = UUID.randomUUID().toString().replace("-",""); 58 | tokenRedisTemplate.save(newToken, uid); 59 | return newToken; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/apns/app.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/apns/app.p12 -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | [%thread] %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %cyan(%logger{32}) - %msg %n 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/page/console/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <@spring.message "module.common.html.title"/> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | <#include "/console/header.html"> 16 | <#include "/console/nav.html"> 17 |
18 |
19 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/page/console/nav.html: -------------------------------------------------------------------------------- 1 | 2 | 23 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/bootstrap-3.3.7-dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js'); 3 | require('../../js/alert.js'); 4 | require('../../js/button.js'); 5 | require('../../js/carousel.js'); 6 | require('../../js/collapse.js'); 7 | require('../../js/dropdown.js'); 8 | require('../../js/modal.js'); 9 | require('../../js/tooltip.js'); 10 | require('../../js/popover.js'); 11 | require('../../js/scrollspy.js'); 12 | require('../../js/tab.js'); 13 | require('../../js/affix.js'); -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/image/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/image/favicon.ico -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/image/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/image/icon.png -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/image/icon/online.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/image/icon_loading_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/image/icon_loading_small.gif -------------------------------------------------------------------------------- /cim-boot-server/src/main/resources/static/image/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-boot-server/src/main/resources/static/image/pattern.png -------------------------------------------------------------------------------- /cim-client-sdk/.idea/cim-client-sdk.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cim-client-sdk/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /cim-client-sdk/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cim-client-sdk/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cim-client-sdk/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 1594434419483 34 | 39 | 40 | 41 | 42 | 44 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .idea/ -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/jar.bat: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/jar.sh: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/libs/android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-android-sdk/libs/android.jar -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/release.sh: -------------------------------------------------------------------------------- 1 | mvn clean install deploy -P release -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/coder/ClientMessageEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.coder; 23 | 24 | import com.farsunset.cim.sdk.android.constant.CIMConstant; 25 | import com.farsunset.cim.sdk.android.model.BinaryBody; 26 | 27 | import java.nio.ByteBuffer; 28 | 29 | public class ClientMessageEncoder { 30 | 31 | public ByteBuffer encode(BinaryBody body) { 32 | 33 | byte[] data = body.getByteArray(); 34 | 35 | ByteBuffer buffer = ByteBuffer.allocate(data.length + CIMConstant.DATA_HEADER_LENGTH); 36 | 37 | buffer.put(createHeader(body.getType(), data.length)); 38 | buffer.put(data); 39 | buffer.flip(); 40 | 41 | return buffer; 42 | 43 | } 44 | 45 | /** 46 | * 消息体最大为65535 47 | */ 48 | private byte[] createHeader(byte type, int length) { 49 | byte[] header = new byte[CIMConstant.DATA_HEADER_LENGTH]; 50 | header[0] = type; 51 | header[1] = (byte) (length & 0xff); 52 | header[2] = (byte) ((length >> 8) & 0xff); 53 | return header; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/constant/BundleKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.constant; 23 | 24 | public interface BundleKey { 25 | 26 | String KEY_SEND_BODY = "KEY_SEND_BODY"; 27 | 28 | String KEY_DELAYED_TIME = "KEY_DELAYED_TIME"; 29 | 30 | String KEY_LOGGER_ENABLE = "KEY_LOGGER_ENABLE"; 31 | 32 | String KEY_NOTIFICATION_MESSAGE = "KEY_NOTIFICATION_MESSAGE"; 33 | 34 | String KEY_NOTIFICATION_CHANNEL = "KEY_NOTIFICATION_CHANNEL"; 35 | 36 | String KEY_NOTIFICATION_ICON = "KEY_NOTIFICATION_ICON"; 37 | 38 | String KEY_RECONNECT_AFTER = "KEY_RECONNECT_AFTER"; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/constant/CIMConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.constant; 23 | 24 | public interface CIMConstant { 25 | 26 | long RECONNECT_INTERVAL_TIME = 5000L; 27 | 28 | /* 29 | * 消息头长度为3个字节,第一个字节为消息类型,第二,第三字节 转换int后为消息长度 30 | */ 31 | int DATA_HEADER_LENGTH = 3; 32 | 33 | /* 34 | 被其他设备登录挤下线消息 35 | */ 36 | String ACTION_999 = "999"; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/constant/ProtobufType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.constant; 23 | 24 | public interface ProtobufType { 25 | 26 | /* 27 | 客户端->服务端 发送的心跳响应 28 | */ 29 | byte PONG = 0; 30 | 31 | /* 32 | 服务端->客户端 发送的心跳请求 33 | */ 34 | byte PING = 1; 35 | 36 | byte MESSAGE = 2; 37 | 38 | byte SENT_BODY = 3; 39 | 40 | byte REPLY_BODY = 4; 41 | } 42 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/constant/RequestKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.constant; 23 | 24 | public interface RequestKey { 25 | 26 | String CLIENT_BIND = "client_bind"; 27 | 28 | String CLIENT_SET_TAG = "client_set_tag"; 29 | 30 | String CLIENT_REMOVE_TAG = "client_remove_tag"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/constant/ServiceAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.constant; 23 | 24 | public interface ServiceAction { 25 | 26 | String ACTION_CREATE_CIM_CONNECTION = "ACTION_CREATE_CIM_CONNECTION"; 27 | 28 | String ACTION_DESTROY_CIM_SERVICE = "ACTION_DESTROY_CIM_SERVICE"; 29 | 30 | String ACTION_ACTIVATE_PUSH_SERVICE = "ACTION_ACTIVATE_PUSH_SERVICE"; 31 | 32 | String ACTION_SEND_REQUEST_BODY = "ACTION_SEND_REQUEST_BODY"; 33 | 34 | String ACTION_CLOSE_CIM_CONNECTION = "ACTION_CLOSE_CIM_CONNECTION"; 35 | 36 | String ACTION_SET_LOGGER_EATABLE = "ACTION_SET_LOGGER_EATABLE"; 37 | 38 | String ACTION_SHOW_PERSIST_NOTIFICATION = "ACTION_SHOW_PERSIST_NOTIFICATION"; 39 | 40 | String ACTION_HIDE_PERSIST_NOTIFICATION = "ACTION_HIDE_PERSIST_NOTIFICATION"; 41 | 42 | String ACTION_CIM_CONNECTION_PONG = "ACTION_CIM_CONNECTION_PONG"; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/BinaryBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.model; 23 | 24 | /** 25 | * 需要向另一端发送的结构体 26 | */ 27 | public interface BinaryBody { 28 | 29 | byte[] getByteArray(); 30 | 31 | byte getType(); 32 | } 33 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/Ping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.model; 23 | 24 | 25 | import java.io.Serializable; 26 | 27 | /** 28 | * 服务端心跳请求 29 | */ 30 | public class Ping implements Serializable { 31 | 32 | private static final long serialVersionUID = 1L; 33 | private static final String TAG = "PING"; 34 | 35 | private static final Ping object = new Ping(); 36 | 37 | private Ping() { 38 | } 39 | 40 | public static Ping getInstance() { 41 | return object; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return TAG; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/Pong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.sdk.android.model; 23 | 24 | import com.farsunset.cim.sdk.android.constant.ProtobufType; 25 | 26 | import java.io.Serializable; 27 | 28 | /** 29 | * 客户端心跳响应 30 | */ 31 | public class Pong implements Serializable, BinaryBody { 32 | 33 | private static final long serialVersionUID = 1L; 34 | private static final String TAG = "PONG"; 35 | private static final String CMD_PONG = "PONG"; 36 | 37 | private static final Pong object = new Pong(); 38 | 39 | private Pong() { 40 | 41 | } 42 | 43 | public static Pong getInstance() { 44 | return object; 45 | } 46 | 47 | @Override 48 | public byte[] getByteArray() { 49 | return CMD_PONG.getBytes(); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return TAG; 55 | } 56 | 57 | @Override 58 | public byte getType() { 59 | return ProtobufType.PONG; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/proto/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.android.model.proto; 3 | option java_outer_classname = "MessageProto"; 4 | message Model { 5 | int64 id = 1; 6 | string action = 2; 7 | string content = 3; 8 | string sender = 4; 9 | string receiver = 5; 10 | string extra = 6; 11 | string title = 7; 12 | string format = 8; 13 | int64 timestamp = 9; 14 | } 15 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/proto/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.android.model.proto; 3 | option java_outer_classname = "ReplyBodyProto"; 4 | 5 | message Model { 6 | string key = 1; 7 | string code = 2; 8 | string message = 3; 9 | int64 timestamp = 4; 10 | map data = 5; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/model/proto/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.android.model.proto; 3 | option java_outer_classname = "SentBodyProto"; 4 | 5 | message Model { 6 | string key = 1; 7 | int64 timestamp = 2; 8 | map data = 3; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/.vs/CIM_SDK/DesignTimeBuild/.dtbcache.v2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/.vs/CIM_SDK/DesignTimeBuild/.dtbcache.v2 -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/.vs/CIM_SDK/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/.vs/CIM_SDK/v16/.suo -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31313.79 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIM_Standard", "CIM_Standard\CIM_Standard.csproj", "{7CF35A93-CD9E-4A34-8B79-6835E4523BF7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIM_SDK_Tests", "CIM_SDK_Tests\CIM_SDK_Tests.csproj", "{372F9F86-C3E8-49B7-A434-09E95BF42F84}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7CF35A93-CD9E-4A34-8B79-6835E4523BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7CF35A93-CD9E-4A34-8B79-6835E4523BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7CF35A93-CD9E-4A34-8B79-6835E4523BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7CF35A93-CD9E-4A34-8B79-6835E4523BF7}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {372F9F86-C3E8-49B7-A434-09E95BF42F84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {372F9F86-C3E8-49B7-A434-09E95BF42F84}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {372F9F86-C3E8-49B7-A434-09E95BF42F84}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {372F9F86-C3E8-49B7-A434-09E95BF42F84}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {48F81742-18F6-4EE4-9390-12A19B39B0D7} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/CIM_SDK_Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/Program.cs: -------------------------------------------------------------------------------- 1 | using CIM_Standard; 2 | using Google.Protobuf; 3 | using System; 4 | using System.Net.Sockets; 5 | using static CIM_Standard.SocketHelper; 6 | 7 | namespace CIM_SDK_Tests 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | Console.WriteLine("-------------应用启动中-------------"); 14 | CIMConnect("127.0.0.1",23456, ConsoleMessage).Wait(); 15 | } 16 | 17 | static void ConsoleMessage(MessageModel model) 18 | { 19 | Console.WriteLine(model.ToString()); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.exe -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.pdb -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\smeb\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\smeb\\.nuget\\packages", 6 | "D:\\vs2019SDK\\NuGetPackages" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_SDK_Tests.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "netcoreapp3.1", 4 | "framework": { 5 | "name": "Microsoft.NETCore.App", 6 | "version": "3.1.0" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_Standard.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_Standard.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_Standard.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/CIM_Standard.pdb -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/Google.Protobuf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/bin/Debug/netcoreapp3.1/Google.Protobuf.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/CIM_SDK_Tests.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\smeb\.nuget\packages\;D:\vs2019SDK\NuGetPackages 9 | PackageReference 10 | 5.10.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/CIM_SDK_Tests.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("CIM_SDK_Tests")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("CIM_SDK_Tests")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("CIM_SDK_Tests")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // 由 MSBuild WriteCodeFragment 类生成。 23 | 24 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 43b12813ced9e02e5719303093f7b8ba6c6bf070 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.assets.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csproj.CopyComplete: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csproj.CopyComplete -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 0db5320ff540808af5cc8e73e174b7b047ca25aa 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.genruntimeconfig.cache: -------------------------------------------------------------------------------- 1 | d379c697e32889a1b1440cc98429be5431bd1dd1 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/CIM_SDK_Tests.pdb -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/apphost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/Debug/netcoreapp3.1/apphost.exe -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_SDK_Tests/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "YuWDnFD2k8txF3N/mj8WGwEFQxC/bvROdXf6iYpWXapQdgzHaVn4JxVF4q9THDg7kNjB+m/bVkODI/avazbb/Q==", 4 | "success": true, 5 | "projectFilePath": "C:\\Users\\smeb\\Desktop\\cim\\cim-client-sdk\\cim-dotnet-sdk\\CIM_SDK_Tests\\CIM_SDK_Tests.csproj", 6 | "expectedPackageFiles": [ 7 | "C:\\Users\\smeb\\.nuget\\packages\\google.protobuf\\3.19.1\\google.protobuf.3.19.1.nupkg.sha512", 8 | "C:\\Users\\smeb\\.nuget\\packages\\system.memory\\4.5.3\\system.memory.4.5.3.nupkg.sha512", 9 | "C:\\Users\\smeb\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\4.5.2\\system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" 10 | ], 11 | "logs": [] 12 | } -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/CIM_Standard.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/bin/Debug/netstandard2.0/CIM_Standard.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/bin/Debug/netstandard2.0/CIM_Standard.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/bin/Debug/netstandard2.0/CIM_Standard.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/bin/Debug/netstandard2.0/CIM_Standard.pdb -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/CIM_Standard.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\smeb\.nuget\packages\;D:\vs2019SDK\NuGetPackages 9 | PackageReference 10 | 5.10.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/CIM_Standard.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("CIM_Standard")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("CIM_Standard")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("CIM_Standard")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // 由 MSBuild WriteCodeFragment 类生成。 23 | 24 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | c640ffd6968abc4da51ad107bdf7f65344ac163b 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.assets.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 4ac43369ce2ba8d4c6d6415c1b6d560187912688 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.csprojAssemblyReference.cache 2 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.AssemblyInfoInputs.cache 3 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.AssemblyInfo.cs 4 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.csproj.CoreCompileInputs.cache 5 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.deps.json 6 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.dll 7 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.pdb 8 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.dll 9 | C:\Users\smeb\Desktop\电小牛V2\CIM_SDK\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.pdb 10 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.deps.json 11 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.dll 12 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\bin\Debug\netstandard2.0\CIM_Standard.pdb 13 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.csproj.AssemblyReference.cache 14 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.AssemblyInfoInputs.cache 15 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.AssemblyInfo.cs 16 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.csproj.CoreCompileInputs.cache 17 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.dll 18 | C:\Users\smeb\Desktop\cim\cim-client-sdk\cim-dotnet-sdk\CIM_Standard\obj\Debug\netstandard2.0\CIM_Standard.pdb 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.dll -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/Debug/netstandard2.0/CIM_Standard.pdb -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/CIM_Standard/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "ksDkEFUx5r8KXdQwAsRSHMCExJx/uYaOL0gSMwQfprA9nV7B6PjK3nYPyO7m99A1+bmvvrm0F/Lpw6WLZdA9fQ==", 4 | "success": true, 5 | "projectFilePath": "C:\\Users\\smeb\\Desktop\\cim\\cim-client-sdk\\cim-dotnet-sdk\\CIM_Standard\\CIM_Standard.csproj", 6 | "expectedPackageFiles": [ 7 | "C:\\Users\\smeb\\.nuget\\packages\\google.protobuf\\3.19.1\\google.protobuf.3.19.1.nupkg.sha512", 8 | "C:\\Users\\smeb\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512", 9 | "C:\\Users\\smeb\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512", 10 | "C:\\Users\\smeb\\.nuget\\packages\\system.buffers\\4.4.0\\system.buffers.4.4.0.nupkg.sha512", 11 | "C:\\Users\\smeb\\.nuget\\packages\\system.memory\\4.5.3\\system.memory.4.5.3.nupkg.sha512", 12 | "C:\\Users\\smeb\\.nuget\\packages\\system.numerics.vectors\\4.4.0\\system.numerics.vectors.4.4.0.nupkg.sha512", 13 | "C:\\Users\\smeb\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\4.5.2\\system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" 14 | ], 15 | "logs": [] 16 | } -------------------------------------------------------------------------------- /cim-client-sdk/cim-dotnet-sdk/使用说明.txt: -------------------------------------------------------------------------------- 1 | 1、 CIM_SDK_Tests 基于NetCore3.1 是命令行测试用例; 2 | CIM_Standard 是sdk 基于NetStandard2.1 3 | 这意味着你可以在任何基于Standard2.1的Net平台上运行 无论是mono NetCore NetFrameWork 4 | 5 | 2、使用时需要引入Google.Protobuf NuGet库 文件夹下Protobuf的model.cs 已经重新命名 可直接使用 否则有命名冲突 6 | 7 | 3、在项目中直接引入CIM_Standard项目即可 -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: Message.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields 7 | 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: Message.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | import 'dart:core' as $core; 9 | import 'dart:convert' as $convert; 10 | import 'dart:typed_data' as $typed_data; 11 | @$core.Deprecated('Use modelDescriptor instead') 12 | const Model$json = const { 13 | '1': 'Model', 14 | '2': const [ 15 | const {'1': 'id', '3': 1, '4': 1, '5': 3, '10': 'id'}, 16 | const {'1': 'action', '3': 2, '4': 1, '5': 9, '10': 'action'}, 17 | const {'1': 'content', '3': 3, '4': 1, '5': 9, '10': 'content'}, 18 | const {'1': 'sender', '3': 4, '4': 1, '5': 9, '10': 'sender'}, 19 | const {'1': 'receiver', '3': 5, '4': 1, '5': 9, '10': 'receiver'}, 20 | const {'1': 'extra', '3': 6, '4': 1, '5': 9, '10': 'extra'}, 21 | const {'1': 'title', '3': 7, '4': 1, '5': 9, '10': 'title'}, 22 | const {'1': 'format', '3': 8, '4': 1, '5': 9, '10': 'format'}, 23 | const {'1': 'timestamp', '3': 9, '4': 1, '5': 3, '10': 'timestamp'}, 24 | ], 25 | }; 26 | 27 | /// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. 28 | final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIOCgJpZBgBIAEoA1ICaWQSFgoGYWN0aW9uGAIgASgJUgZhY3Rpb24SGAoHY29udGVudBgDIAEoCVIHY29udGVudBIWCgZzZW5kZXIYBCABKAlSBnNlbmRlchIaCghyZWNlaXZlchgFIAEoCVIIcmVjZWl2ZXISFAoFZXh0cmEYBiABKAlSBWV4dHJhEhQKBXRpdGxlGAcgASgJUgV0aXRsZRIWCgZmb3JtYXQYCCABKAlSBmZvcm1hdBIcCgl0aW1lc3RhbXAYCSABKANSCXRpbWVzdGFtcA=='); 29 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbserver.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: Message.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | export 'Message.pb.dart'; 9 | 10 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: ReplyBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields 7 | 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: ReplyBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | import 'dart:core' as $core; 9 | import 'dart:convert' as $convert; 10 | import 'dart:typed_data' as $typed_data; 11 | @$core.Deprecated('Use modelDescriptor instead') 12 | const Model$json = const { 13 | '1': 'Model', 14 | '2': const [ 15 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 16 | const {'1': 'code', '3': 2, '4': 1, '5': 9, '10': 'code'}, 17 | const {'1': 'message', '3': 3, '4': 1, '5': 9, '10': 'message'}, 18 | const {'1': 'timestamp', '3': 4, '4': 1, '5': 3, '10': 'timestamp'}, 19 | const {'1': 'data', '3': 5, '4': 3, '5': 11, '6': '.Model.DataEntry', '10': 'data'}, 20 | ], 21 | '3': const [Model_DataEntry$json], 22 | }; 23 | 24 | @$core.Deprecated('Use modelDescriptor instead') 25 | const Model_DataEntry$json = const { 26 | '1': 'DataEntry', 27 | '2': const [ 28 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 29 | const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, 30 | ], 31 | '7': const {'7': true}, 32 | }; 33 | 34 | /// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. 35 | final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIQCgNrZXkYASABKAlSA2tleRISCgRjb2RlGAIgASgJUgRjb2RlEhgKB21lc3NhZ2UYAyABKAlSB21lc3NhZ2USHAoJdGltZXN0YW1wGAQgASgDUgl0aW1lc3RhbXASJAoEZGF0YRgFIAMoCzIQLk1vZGVsLkRhdGFFbnRyeVIEZGF0YRo3CglEYXRhRW50cnkSEAoDa2V5GAEgASgJUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4AQ=='); 36 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbserver.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: ReplyBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | export 'ReplyBody.pb.dart'; 9 | 10 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: SentBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields 7 | 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: SentBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | import 'dart:core' as $core; 9 | import 'dart:convert' as $convert; 10 | import 'dart:typed_data' as $typed_data; 11 | @$core.Deprecated('Use modelDescriptor instead') 12 | const Model$json = const { 13 | '1': 'Model', 14 | '2': const [ 15 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 16 | const {'1': 'timestamp', '3': 2, '4': 1, '5': 3, '10': 'timestamp'}, 17 | const {'1': 'data', '3': 3, '4': 3, '5': 11, '6': '.Model.DataEntry', '10': 'data'}, 18 | ], 19 | '3': const [Model_DataEntry$json], 20 | }; 21 | 22 | @$core.Deprecated('Use modelDescriptor instead') 23 | const Model_DataEntry$json = const { 24 | '1': 'DataEntry', 25 | '2': const [ 26 | const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, 27 | const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, 28 | ], 29 | '7': const {'7': true}, 30 | }; 31 | 32 | /// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. 33 | final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIQCgNrZXkYASABKAlSA2tleRIcCgl0aW1lc3RhbXAYAiABKANSCXRpbWVzdGFtcBIkCgRkYXRhGAMgAygLMhAuTW9kZWwuRGF0YUVudHJ5UgRkYXRhGjcKCURhdGFFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YWx1ZRgCIAEoCVIFdmFsdWU6AjgB'); 34 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbserver.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: SentBody.proto 4 | // 5 | // @dart = 2.12 6 | // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package 7 | 8 | export 'SentBody.pb.dart'; 9 | 10 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-ios-oc-sdk/README.txt: -------------------------------------------------------------------------------- 1 | 仓库地址:https://gitee.com/farsunset/cim-ios-sdk 2 | 在线文档:https://www.yuque.com/yuanfangxiyang/ma4ytb/sg6lg4 -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "CIMClient", 8 | platforms: [ 9 | .iOS(.v11), 10 | .macOS(.v11), 11 | ], 12 | products: [ 13 | // Products define the executables and libraries a package produces, and make them visible to other packages. 14 | .library( 15 | name: "CIMClient", 16 | targets: ["CIMClient"]), 17 | ], 18 | dependencies: [ 19 | // Dependencies declare other packages that this package depends on. 20 | // .package(url: /* package url */, from: "1.0.0"), 21 | .package(url: "https://github.com/daltoniam/Starscream.git", .upToNextMajor(from: "4.0.0")), 22 | .package(url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.6.0")), 23 | .package(url: "https://github.com/stephencelis/SQLite.swift.git", .upToNextMajor(from: "0.13.0")), 24 | ], 25 | targets: [ 26 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 27 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 28 | .target( 29 | name: "CIMClient", 30 | dependencies: [ 31 | .product(name: "Starscream", package: "Starscream"), 32 | .product(name: "SwiftProtobuf", package: "swift-protobuf"), 33 | .product(name: "SQLite", package: "SQLite.swift"), 34 | ]), 35 | .testTarget( 36 | name: "CIMClientTests", 37 | dependencies: ["CIMClient"]), 38 | ] 39 | ) 40 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/README.md: -------------------------------------------------------------------------------- 1 | # CIMClient 2 | 3 | A description of this package. 4 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Coder/WebMessageDecoder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WebMessageDecoder.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | class WebMessageDecoder { 11 | 12 | func decoder(_ data: Data) -> Transportable? { 13 | let msg = MessageBuilder() 14 | .set(transportData: data) 15 | .build() 16 | return msg 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Coder/WebMessageEncoder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WebMessageEncoder.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | class WebMessageEncoder { 11 | 12 | func encoder(_ msg: Transportable) -> Data { 13 | var data = Data(msg.type.bytes) 14 | data.append(contentsOf: msg.body) 15 | return data 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Constant/CIMError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CIMError.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | public class CIMError: Error { 11 | 12 | public enum CIMErrorCode:UInt16 { 13 | 14 | case msgDecodeErr = 1000 15 | 16 | var desc: String { 17 | switch self { 18 | case .msgDecodeErr: return "消息解析失败" 19 | } 20 | } 21 | } 22 | 23 | let code: UInt16 24 | let reason: String 25 | 26 | public init(code: UInt16, reason: String?) { 27 | self.code = code 28 | self.reason = reason ?? "Unknown Error" 29 | } 30 | 31 | public init(code: CIMErrorCode) { 32 | self.code = code.rawValue 33 | self.reason = code.desc 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Constant/Constant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constant.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | /// 消息类型 11 | public enum MessageType { 12 | 13 | public enum Key: UInt8 { 14 | case pong = 0 15 | case ping = 1 16 | case message = 2 17 | case sentBody = 3 18 | case replyBody = 4 19 | } 20 | 21 | case pong(Pong) 22 | case ping(Ping) 23 | case message(Message) 24 | case sentBody(SentBody) 25 | case replyBody(ReplyBody) 26 | 27 | var bytes: [UInt8] { 28 | switch self { 29 | case .pong: return [Key.pong.rawValue] 30 | case .ping: return [Key.ping.rawValue] 31 | case .message: return [Key.message.rawValue] 32 | case .sentBody: return [Key.sentBody.rawValue] 33 | case .replyBody: return [Key.replyBody.rawValue] 34 | } 35 | } 36 | } 37 | 38 | public enum ConnectEvent { 39 | case connecting 40 | case connected([String: String]) 41 | case disconnected(String, UInt16) 42 | case error(Error?) 43 | case cancelled 44 | case bindUser(Bool) 45 | } 46 | 47 | let sdkVersion: String = "cimsdk-ios-1.0.0" 48 | 49 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Core/MessageSender.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageSender.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/2. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol MessageSender { 11 | 12 | func sendTextMessage(_ text: String, receiver: String) 13 | } 14 | 15 | class MessageSenderImp: MessageSender { 16 | 17 | weak var client: CIMClient? 18 | 19 | init(client: CIMClient) { 20 | self.client = client 21 | } 22 | 23 | func sendTextMessage(_ text: String, receiver: String) { 24 | if let client = client { 25 | if let account = client.account { 26 | let msg = MessageBuilder() 27 | .set(type: .message) 28 | .set(action: "2") 29 | .set(sender: String(account.id)) 30 | .set(receiver: receiver) 31 | .set(title: "title") 32 | .set(content: text) 33 | .set(format: "") 34 | .set(extra: "") 35 | .build() 36 | if let msg = msg { 37 | client.sendMessage(msg) 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/DB/CIMDBManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CIMDBManager.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/2. 6 | // 7 | 8 | import Foundation 9 | import SQLite 10 | 11 | class CIMDBManager { 12 | 13 | let path: String 14 | 15 | lazy var db: Connection? = { 16 | do { 17 | let db = try Connection(path) 18 | return db 19 | } catch { 20 | return nil 21 | } 22 | }() 23 | 24 | lazy var messageDB: MessageDB = { [unowned self] in 25 | let messageDB = MessageDB(db: self) 26 | return messageDB 27 | }() 28 | 29 | init(path: String) { 30 | self.path = path 31 | } 32 | 33 | func execute(query: String) throws { 34 | print("DB query: \(query)") 35 | if let db = db { 36 | do { 37 | try db.execute(query) 38 | } catch { 39 | print("DB 查询语句执行失败!") 40 | } 41 | } else { 42 | print("DB 连接失败!") 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/DB/MessageDB.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageDB.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/2. 6 | // 7 | 8 | import Foundation 9 | 10 | class MessageDB { 11 | 12 | weak var db: CIMDBManager? 13 | 14 | init(db: CIMDBManager) { 15 | self.db = db 16 | do { 17 | try createTable() 18 | } catch { 19 | 20 | } 21 | } 22 | 23 | func createTable() throws { 24 | 25 | let createSQL = """ 26 | CREATE TABLE IF NOT EXISTS "messages" ( 27 | "id" INT64 NOT NULL, 28 | "action" TEXT NOT NULL, 29 | "title" TEXT NOT NULL, 30 | "content" TEXT NOT NULL, 31 | "sender" TEXT NOT NULL, 32 | "receiver" TEXT NOT NULL, 33 | "format" TEXT NOT NULL, 34 | "extra" TEXT NOT NULL, 35 | "timestamp" INT64 NOT NULL, 36 | PRIMARY KEY("id") 37 | ); 38 | """ 39 | try db?.execute(query: createSQL) 40 | } 41 | 42 | func insert(_ message: Message) throws { 43 | 44 | let insertSQL = """ 45 | REPLACE INTO "messages" ("id","action","title","content","sender","receiver","format","extra","timestamp") VALUES ( 46 | \(message.id), 47 | "\(message.action)", 48 | "\(message.title)", 49 | "\(message.content)", 50 | "\(message.sender)", 51 | "\(message.receiver)", 52 | "\(message.format)", 53 | "\(message.extra)", 54 | \(message.timestamp)); 55 | """ 56 | try db?.execute(query: insertSQL) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Extension/Date+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+Extension.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Date { 11 | 12 | func currentTimestamp() -> Int64 { 13 | let timeInterval: TimeInterval = Date().timeIntervalSince1970 * 1000 14 | let timestamp = Int64(timeInterval) 15 | return timestamp 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/AutoReConnectInterceptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AutoReConnectInterceptor.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | class AutoReConnectInterceptor: MessageInterceptor { 11 | 12 | var uniqueID: String = UUID().uuidString 13 | 14 | weak var client: CIMClient? 15 | 16 | init(client: CIMClient) { 17 | self.client = client 18 | } 19 | 20 | func connect(_ event: ConnectEvent) { 21 | switch event { 22 | case .connected(_): 23 | if let account = self.client?.account { 24 | let msg = MessageBuilder() 25 | .set(type: .sentBody) 26 | .set(key: "client_bind") 27 | .set(data: [ 28 | "uid": String(account.id), 29 | "channel": "ios", 30 | "deviceId": UUID().uuidString, //UIDevice.current.identifierForVendor?.uuidString ?? "", 31 | "token": account.token ?? "" 32 | ]) 33 | .build() 34 | if let client = self.client, 35 | let msg = msg { 36 | client.sendMessage(msg) 37 | } 38 | } 39 | break 40 | default: 41 | break 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/ConnectListener.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectListener.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol ConnectListener { 11 | 12 | var uniqueID: String { get } 13 | 14 | func connect(_ event: ConnectEvent) 15 | } 16 | 17 | extension ConnectListener { 18 | 19 | func connect(_ event: ConnectEvent) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/MessageDatabaseInterceptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageDBInterceptor.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/2. 6 | // 7 | 8 | import Foundation 9 | 10 | class MessageDatabaseInterceptor: MessageInterceptor { 11 | 12 | var uniqueID: String = UUID().uuidString 13 | 14 | let dbManager: CIMDBManager? = { 15 | 16 | let fileManager = FileManager.default 17 | if let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first { 18 | let databasePath = documentsURL.appendingPathComponent("db.sqlite3").path 19 | print("directory path:", documentsURL.path) 20 | print("database path:", databasePath) 21 | if !fileManager.fileExists(atPath: databasePath) { 22 | fileManager.createFile(atPath: databasePath, contents: nil, attributes: nil) 23 | } 24 | let dbManager = CIMDBManager(path: databasePath) 25 | return dbManager 26 | } 27 | return nil 28 | }() 29 | 30 | /// MARK: - MessageListener 31 | func receiveMessage(_ message: Transportable) { 32 | do { 33 | try insertMsg(message) 34 | } catch { 35 | 36 | } 37 | } 38 | 39 | /// MARK: - MessageSendListener 40 | func sendMessage(_ message: Transportable) { 41 | do { 42 | try insertMsg(message) 43 | } catch { 44 | 45 | } 46 | } 47 | 48 | func insertMsg(_ message: Transportable) throws { 49 | switch message.type { 50 | case .message(let msg): 51 | try dbManager?.messageDB.insert(msg) 52 | break 53 | default: 54 | break 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/MessageInterceptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageInterceptor.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol MessageInterceptor: ConnectListener & MessageSendListener & MessageListener { 11 | var uniqueID: String { get } 12 | } 13 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/MessageListener.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageListener.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol MessageListener { 11 | 12 | var uniqueID: String { get } 13 | 14 | func receiveMessage(_ message: Transportable) 15 | 16 | func receiveMessageWithError(_ error: Error) 17 | } 18 | 19 | public protocol MessageSendListener { 20 | 21 | func sendMessage(_ message: Transportable) 22 | } 23 | 24 | extension MessageListener { 25 | 26 | func receiveMessage(_ message: Transportable) { 27 | 28 | } 29 | 30 | func receiveMessageWithError(_ error: Error) { 31 | 32 | } 33 | } 34 | 35 | extension MessageSendListener { 36 | 37 | func sendMessage(_ message: Transportable) { 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/MessageInterceptor/MessageLogInterceptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageLogInterceptor.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | import Starscream 10 | 11 | class MessageLogInterceptor: MessageInterceptor { 12 | 13 | var uniqueID: String = UUID().uuidString 14 | 15 | /// MARK: - ConnectListener 16 | func connect(_ event: ConnectEvent) { 17 | switch event { 18 | case .connecting: 19 | print("连接服务器。。。") 20 | break 21 | case .connected(let header): 22 | print("服务器连接成功!Header:\(header)") 23 | break 24 | case .disconnected(let reason, let code): 25 | print("与服务器断开连接。原因:\(reason) Code: \(code)") 26 | break 27 | case .error(let error): 28 | if let e = error as? WSError { 29 | print("websocket encountered an error: \(e.message)") 30 | } else if let e = error { 31 | print("websocket encountered an error: \(e.localizedDescription)") 32 | } else { 33 | print("websocket encountered an error") 34 | } 35 | break 36 | case .cancelled: 37 | print("取消连接") 38 | break 39 | case .bindUser(let success): 40 | print("用户绑定结果:\(success)") 41 | break 42 | } 43 | } 44 | 45 | /// MARK: - MessageListener 46 | func receiveMessage(_ message: Transportable) { 47 | print("Receive: \(message)") 48 | } 49 | 50 | func receiveMessageWithError(_ error: Error) { 51 | print("Receive Error: \(error)") 52 | } 53 | 54 | /// MARK: - MessageSendListener 55 | func sendMessage(_ message: Transportable) { 56 | print("Sent: \(message)") 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/Account.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Account.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/10/1. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct Account: Codable { 11 | public let id: Int64 12 | public let name: String 13 | public let token: String? 14 | 15 | public init(id: Int64, name: String, token: String?) { 16 | self.id = id 17 | self.name = name 18 | self.token = token 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/Ping.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Ping.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct Ping: Codable { 11 | let data: String 12 | public init() { 13 | self.data = "PING" 14 | } 15 | } 16 | 17 | extension Ping: Transportable { 18 | 19 | public var type: MessageType { 20 | get { 21 | return .ping(self) 22 | } 23 | } 24 | 25 | public var body: [UInt8] { 26 | get { 27 | let body: [UInt8] = Array(data.utf8) 28 | return body 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/Pong.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Pong.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct Pong: Codable { 11 | let data: String 12 | public init() { 13 | self.data = "PONG" 14 | } 15 | } 16 | 17 | extension Pong: Transportable { 18 | 19 | public var type: MessageType { 20 | get { 21 | return .pong(self) 22 | } 23 | } 24 | 25 | public var body: [UInt8] { 26 | get { 27 | let body: [UInt8] = Array(data.utf8) 28 | return body 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/ReplyBody.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReplyBody.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ReplyBody: Codable { 11 | 12 | let key: String 13 | let code: String 14 | let message: String? 15 | let data: [String: String]? 16 | let timestamp: Int64 17 | 18 | public init(key: String, code: String, message: String?, data: [String: String]?) { 19 | self.key = key 20 | self.code = code 21 | self.message = message 22 | self.data = data 23 | self.timestamp = Date().currentTimestamp() 24 | } 25 | 26 | init(bytes: [UInt8]) { 27 | let replyBody = try! ReplayBodyProto.init(contiguousBytes: bytes) 28 | self.key = replyBody.key 29 | self.code = replyBody.code 30 | self.message = replyBody.message 31 | self.data = replyBody.data 32 | self.timestamp = replyBody.timestamp 33 | } 34 | } 35 | 36 | extension ReplyBody: Transportable { 37 | 38 | public var type: MessageType { 39 | get { 40 | return .replyBody(self) 41 | } 42 | } 43 | 44 | public var body: [UInt8] { 45 | get { 46 | var replyBody = ReplayBodyProto() 47 | replyBody.key = key 48 | replyBody.code = code 49 | if let msg: String = message { 50 | replyBody.message = msg 51 | } 52 | if let data = data { 53 | data.forEach { k, v in 54 | replyBody.data[k] = v 55 | } 56 | } 57 | replyBody.timestamp = timestamp 58 | let serializedData = try! replyBody.serializedData() 59 | let body: [UInt8] = serializedData.map{$0} 60 | return body 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/SentBody.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SentBody.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct SentBody: Codable { 11 | let key: String 12 | let timestamp: Int64 13 | let data: [String:String] 14 | 15 | public init(key: String, data: [String: String]) { 16 | self.key = key 17 | self.data = data 18 | self.timestamp = Date().currentTimestamp() 19 | } 20 | 21 | init(bytes: [UInt8]) { 22 | let sentBody = try! SentBodyProto.init(contiguousBytes: bytes) 23 | self.key = sentBody.key 24 | self.data = sentBody.data 25 | self.timestamp = sentBody.timestamp 26 | } 27 | } 28 | 29 | extension SentBody: Transportable { 30 | 31 | public var type: MessageType { 32 | get { 33 | return .sentBody(self) 34 | } 35 | } 36 | 37 | public var body: [UInt8] { 38 | get { 39 | var sentBody = SentBodyProto() 40 | sentBody.key = key 41 | sentBody.timestamp = timestamp 42 | data.forEach { k,v in 43 | sentBody.data[k] = v 44 | } 45 | let serializedData = try! sentBody.serializedData() 46 | let body: [UInt8] = serializedData.map{$0} 47 | return body 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Sources/CIMClient/Model/Transportable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Transportable.swift 3 | // cimsdk 4 | // 5 | // Created by FeiYu on 2021/9/27. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol Transportable { 11 | var body: [UInt8] { get } 12 | var type: MessageType { get } 13 | } 14 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/CIMClient/Tests/CIMClientTests/CIMClientTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import CIMClient 3 | 4 | final class CIMClientTests: XCTestCase { 5 | func testExample() throws { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | // XCTAssertEqual(CIMClient().text, "Hello, World!") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/Assets.xcassets/avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "avatar.jpg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/Assets.xcassets/avatar.imageset/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-swift-sdk/Demo/Shared/Assets.xcassets/avatar.imageset/avatar.jpg -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/CIMAppApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CIMAppApp.swift 3 | // Shared 4 | // 5 | // Created by FeiYu on 2021/10/10. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct CIMAppApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | .windowStyle(HiddenTitleBarWindowStyle()) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Shared 4 | // 5 | // Created by FeiYu on 2021/10/10. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | Button("sent msg") { 13 | imClient.msgSender.sendTextMessage("hello", receiver: "123456") 14 | } 15 | } 16 | } 17 | 18 | struct ContentView_Previews: PreviewProvider { 19 | static var previews: some View { 20 | ContentView() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/Shared/IMClient.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IMClient.swift 3 | // CIMApp (iOS) 4 | // 5 | // Created by FeiYu on 2021/10/10. 6 | // 7 | 8 | import Foundation 9 | import CIMClient 10 | 11 | let account = Account(id: 111111, name: "FeiYu", token: "qwqewewrettryry") 12 | let imClient = CIMClient(url: "ws://192.168.2.100:34567") 13 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/10. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | Home() 13 | } 14 | } 15 | 16 | struct ContentView_Previews: PreviewProvider { 17 | static var previews: some View { 18 | ContentView() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extension.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | extension NSTextField { 11 | 12 | open override var focusRingType: NSFocusRingType { 13 | get{.none} 14 | set{} 15 | } 16 | } 17 | 18 | extension Int64 { 19 | 20 | //MARK: -时间戳转时间 21 | func timeStampToTime() -> String { 22 | let currentTime = Date().timeIntervalSince1970 23 | let timeSta: TimeInterval = TimeInterval(self / 1000) 24 | let reduceTime : TimeInterval = currentTime - timeSta 25 | let hours = Int(reduceTime / 3600) 26 | let date = NSDate(timeIntervalSince1970: timeSta) 27 | let dfmatter = DateFormatter() 28 | if hours < 24 { 29 | dfmatter.dateFormat="HH:mm" 30 | return dfmatter.string(from: date as Date) 31 | } 32 | let days = Int(reduceTime / 3600 / 24) 33 | if days < 365 { 34 | dfmatter.dateFormat="MM月dd日 HH:mm" 35 | return dfmatter.string(from: date as Date) 36 | } 37 | dfmatter.dateFormat="yyyy年MM月dd日 HH:mm:ss" 38 | return dfmatter.string(from: date as Date) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/Model/Session.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Session.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | import CIMClient 10 | 11 | struct Session: Identifiable { 12 | var id: String 13 | var lastMsg: String 14 | var lastMsgTime: String 15 | var pendingMsgs: String 16 | var userName: String 17 | var userImage: String 18 | var allMsgs: [Message] 19 | } 20 | 21 | var localSessions : [Session] = [] 22 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/Model/User.swift: -------------------------------------------------------------------------------- 1 | // 2 | // User.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/16. 6 | // 7 | 8 | import Foundation 9 | 10 | struct User: Identifiable { 11 | var id: String = "" 12 | var name: String = "name" 13 | var avatar: String = "avatar" 14 | } 15 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/View/AllChatsView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AllChatsView.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AllChatsView: View { 11 | 12 | @EnvironmentObject var homeData: HomeViewModel 13 | var body: some View { 14 | // Side Tab View.... 15 | 16 | VStack { 17 | 18 | HStack { 19 | Spacer() 20 | Button(action: {}, label: { 21 | Image(systemName: "plus") 22 | .font(.title2) 23 | .foregroundColor(.white) 24 | }) 25 | .buttonStyle(PlainButtonStyle()) 26 | } 27 | .padding(.horizontal) 28 | 29 | HStack{ 30 | Image(systemName: "magnifyingglass") 31 | .foregroundColor(.gray) 32 | TextField("Search", text: $homeData.search) 33 | .textFieldStyle(PlainTextFieldStyle()) 34 | } 35 | .padding(.vertical, 8) 36 | .padding(.horizontal) 37 | .background(Color.primary.opacity(0.15)) 38 | .cornerRadius(10) 39 | .padding() 40 | 41 | 42 | List(selection: $homeData.selectedSession){ 43 | 44 | ForEach(homeData.sessions) { session in 45 | 46 | NavigationLink(destination: DetailView(session: session)) { 47 | RecentCardView(session: session) 48 | } 49 | 50 | } 51 | } 52 | } 53 | .frame(minWidth: 280) 54 | .listStyle(SidebarListStyle()) 55 | 56 | 57 | } 58 | } 59 | 60 | struct AllChatsView_Previews: PreviewProvider { 61 | static var previews: some View { 62 | Home() 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/View/BlurView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BlurView.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct BlurView: NSViewRepresentable { 11 | 12 | 13 | func makeNSView(context: Context) -> NSVisualEffectView { 14 | let view = NSVisualEffectView() 15 | view.blendingMode = .behindWindow 16 | return view 17 | } 18 | 19 | func updateNSView(_ nsView: NSVisualEffectView, context: Context) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/View/Home.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Home.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | var screen = NSScreen.main!.visibleFrame 11 | 12 | struct Home: View { 13 | 14 | @StateObject var homeData = HomeViewModel() 15 | 16 | var body: some View { 17 | 18 | HStack(spacing:0) { 19 | VStack { 20 | 21 | TabButton(image: "message", title: "All Chats", selectedTab: $homeData.selectedTab) 22 | TabButton(image: "person", title: "Personal", selectedTab: $homeData.selectedTab) 23 | TabButton(image: "bubble.middle.bottom", title: "Bots", selectedTab: $homeData.selectedTab) 24 | TabButton(image: "slider.horizontal.3", title: "Edit", selectedTab: $homeData.selectedTab) 25 | Spacer() 26 | TabButton(image: "gear", title: "Settings", selectedTab: $homeData.selectedTab) 27 | } 28 | .padding() 29 | .padding(.top, 35) 30 | .background(BlurView()) 31 | 32 | // Tab Content 33 | ZStack { 34 | 35 | switch homeData.selectedTab { 36 | case "All Chats": NavigationView{ 37 | AllChatsView() 38 | } 39 | case "Personal": Text("Personal") 40 | case "Bots": Text("Bots") 41 | case "Edit": Text("Edit") 42 | case "Settings": Text("Settings") 43 | default: Text("") 44 | } 45 | } 46 | .frame(maxWidth: .infinity, maxHeight: .infinity) 47 | } 48 | .ignoresSafeArea(.all, edges: .all) 49 | .frame(minWidth: screen.width / 1.2, maxWidth: .infinity, minHeight: screen.height - 60, maxHeight: .infinity) 50 | .environmentObject(homeData) 51 | } 52 | } 53 | 54 | struct Home_Previews: PreviewProvider { 55 | static var previews: some View { 56 | Home() 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/View/RecentCardView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RecentCardView.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct RecentCardView: View { 11 | var session: Session 12 | var body: some View { 13 | HStack { 14 | 15 | Image(session.userImage) 16 | .resizable() 17 | .aspectRatio(contentMode: .fill) 18 | .frame(width: 40, height: 40) 19 | .clipShape(Circle()) 20 | 21 | VStack(spacing: 4) { 22 | HStack{ 23 | VStack(alignment: .leading, spacing: 4) { 24 | Text(session.userName) 25 | .fontWeight(.bold) 26 | Text(session.lastMsg) 27 | .font(.caption) 28 | } 29 | Spacer(minLength: 10) 30 | VStack{ 31 | Text(session.lastMsgTime) 32 | .font(.caption) 33 | Text(session.pendingMsgs) 34 | .font(.caption2) 35 | .padding(5) 36 | .foregroundColor(.white) 37 | .background(Color.blue) 38 | .clipShape(Circle()) 39 | } 40 | } 41 | } 42 | } 43 | } 44 | } 45 | 46 | struct RecentCardView_Previews: PreviewProvider { 47 | static var previews: some View { 48 | Home() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/View/TabButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TabButton.swift 3 | // CIMApp (macOS) 4 | // 5 | // Created by FeiYu on 2021/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TabButton: View { 11 | 12 | var image: String 13 | var title: String 14 | @Binding var selectedTab: String 15 | 16 | var body: some View { 17 | Button(action: {withAnimation{selectedTab = title}}) { 18 | 19 | VStack(spacing: 7) { 20 | Image(systemName: image) 21 | .font(.system(size: 16, weight: .semibold)) 22 | .foregroundColor(selectedTab == title ? .white : .gray) 23 | 24 | Text(title) 25 | .fontWeight(.semibold) 26 | .font(.system(size: 11)) 27 | .foregroundColor(selectedTab == title ? .white : .gray) 28 | } 29 | .padding(.vertical, 8) 30 | .frame(width: 70) 31 | .contentShape(Rectangle()) 32 | .background(Color.primary.opacity(selectedTab == title ? 0.15 : 0)) 33 | .cornerRadius(10) 34 | } 35 | .buttonStyle(PlainButtonStyle()) 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Demo/macOS/macOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | com.apple.security.network.server 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "CIMClient", 8 | platforms: [ 9 | .iOS(.v11), 10 | .macOS(.v11), 11 | ], 12 | products: [ 13 | // Products define the executables and libraries a package produces, and make them visible to other packages. 14 | .library( 15 | name: "CIMClient", 16 | targets: ["CIMClient"]), 17 | ], 18 | dependencies: [ 19 | // Dependencies declare other packages that this package depends on. 20 | // .package(url: /* package url */, from: "1.0.0"), 21 | .package(url: "https://github.com/daltoniam/Starscream.git", .upToNextMajor(from: "4.0.0")), 22 | .package(url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.6.0")), 23 | .package(url: "https://github.com/stephencelis/SQLite.swift.git", .upToNextMajor(from: "0.13.0")), 24 | ], 25 | targets: [ 26 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 27 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 28 | .target( 29 | name: "CIMClient", 30 | dependencies: [ 31 | .product(name: "Starscream", package: "Starscream"), 32 | .product(name: "SwiftProtobuf", package: "swift-protobuf"), 33 | .product(name: "SQLite", package: "SQLite.swift"), 34 | ], 35 | path: "CIMClient/Sources/CIMClient"), 36 | .testTarget( 37 | name: "CIMClientTests", 38 | dependencies: ["CIMClient"], 39 | path: "CIMClient/Tests/CIMClientTests"), 40 | ] 41 | ) 42 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/README.md: -------------------------------------------------------------------------------- 1 | # Demo 2 | 3 | 4 | ## macOS Demo [参考教程](https://www.bilibili.com/video/BV1U5411E77K) 5 | 6 | ![Demo](./screenshot/macOS.png) 7 | 8 | 9 | 10 | ## 变更记录 11 | 12 | ### v2.0 13 | * 弃用cocoapods, 支持SPM 14 | * SwiftUI Hello world! 15 | 16 | ### v1.0 17 | * 支持cocoapods 18 | * 实现消息收发 19 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/proto/MessageProto.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message MessageProto { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/proto/ReplyBodyProto.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message ReplayBodyProto { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | 11 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/proto/SentBodyProto.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message SentBodyProto { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/proto/translate.sh: -------------------------------------------------------------------------------- 1 | protoc --swift_out=. *.proto 2 | -------------------------------------------------------------------------------- /cim-client-sdk/cim-swift-sdk/screenshot/macOS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-client-sdk/cim-swift-sdk/screenshot/macOS.png -------------------------------------------------------------------------------- /cim-server-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .idea/ -------------------------------------------------------------------------------- /cim-server-sdk/jar.bat: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-server-sdk/jar.sh: -------------------------------------------------------------------------------- 1 | mvn clean package -------------------------------------------------------------------------------- /cim-server-sdk/release.sh: -------------------------------------------------------------------------------- 1 | mvn clean install deploy -P release -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/coder/json/TransmitBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.coder.json; 23 | 24 | /** 25 | * json协议下的消息结构 26 | */ 27 | class TransmitBody { 28 | 29 | private byte type; 30 | 31 | private String content; 32 | 33 | public byte getType() { 34 | return type; 35 | } 36 | 37 | public void setType(byte type) { 38 | this.type = type; 39 | } 40 | 41 | public String getContent() { 42 | return content; 43 | } 44 | 45 | public void setContent(String content) { 46 | this.content = content; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/coder/protobuf/WebMessageEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.coder.protobuf; 23 | 24 | import com.farsunset.cim.model.Transportable; 25 | import io.netty.buffer.ByteBuf; 26 | import io.netty.buffer.ByteBufAllocator; 27 | import io.netty.channel.ChannelHandlerContext; 28 | import io.netty.handler.codec.MessageToMessageEncoder; 29 | import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; 30 | 31 | import java.util.List; 32 | 33 | /** 34 | * websocket发送消息前编码 35 | */ 36 | public class WebMessageEncoder extends MessageToMessageEncoder { 37 | 38 | @Override 39 | protected void encode(ChannelHandlerContext ctx, Transportable data, List out){ 40 | byte[] body = data.getBody(); 41 | ByteBufAllocator allocator = ctx.channel().config().getAllocator(); 42 | ByteBuf buffer = allocator.buffer(body.length + 1); 43 | buffer.writeByte(data.getType().getValue()); 44 | buffer.writeBytes(body); 45 | out.add(new BinaryWebSocketFrame(buffer)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/constant/CIMConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.constant; 23 | 24 | /** 25 | * 常量 26 | */ 27 | public interface CIMConstant { 28 | 29 | /** 30 | 消息头长度为3个字节,第一个字节为消息类型,第二,第三字节 转换int后为消息长度 31 | */ 32 | byte DATA_HEADER_LENGTH = 3; 33 | 34 | String CLIENT_CONNECT_CLOSED = "client_closed"; 35 | 36 | String CLIENT_HANDSHAKE = "client_handshake"; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/constant/ChannelAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.constant; 23 | 24 | import io.netty.util.AttributeKey; 25 | 26 | public interface ChannelAttr { 27 | AttributeKey PING_COUNT = AttributeKey.valueOf("ping_count"); 28 | AttributeKey UID = AttributeKey.valueOf("uid"); 29 | AttributeKey CHANNEL = AttributeKey.valueOf("channel"); 30 | AttributeKey ID = AttributeKey.valueOf("id"); 31 | AttributeKey DEVICE_ID = AttributeKey.valueOf("device_id"); 32 | AttributeKey TAG = AttributeKey.valueOf("tag"); 33 | AttributeKey LANGUAGE = AttributeKey.valueOf("language"); 34 | } 35 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/constant/DataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.constant; 23 | 24 | /** 25 | * 数据类型 26 | */ 27 | public enum DataType { 28 | 29 | /** 30 | * 客户端发送的的心跳响应 31 | */ 32 | PONG (0), 33 | 34 | /** 35 | * 服务端端发送的心跳响应 36 | */ 37 | PING (1), 38 | 39 | /** 40 | * 服务端端发送的消息体 41 | */ 42 | MESSAGE (2), 43 | 44 | /** 45 | * 客户端发送的请求体 46 | */ 47 | SENT (3), 48 | 49 | /** 50 | * 服务端端发送的响应体 51 | */ 52 | REPLY (4); 53 | 54 | private final byte value; 55 | 56 | DataType(int value) { 57 | this.value = (byte) value; 58 | } 59 | 60 | public byte getValue() { 61 | return value; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/constant/WebsocketProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.constant; 23 | 24 | /** 25 | * websocket 支持的消息体协议 26 | */ 27 | public enum WebsocketProtocol{ 28 | PROTOBUF,JSON 29 | } 30 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/exception/ReadInvalidTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.exception; 23 | 24 | public class ReadInvalidTypeException extends RuntimeException{ 25 | 26 | public ReadInvalidTypeException(byte type) { 27 | super("Read invalid tag : " + type); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/group/TagSessionGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.group; 23 | 24 | 25 | import com.farsunset.cim.constant.ChannelAttr; 26 | import io.netty.channel.Channel; 27 | 28 | 29 | /** 30 | * 基于内存管理的channel组 31 | * 根据tag管理 32 | */ 33 | public class TagSessionGroup extends SessionGroup { 34 | 35 | @Override 36 | protected String getKey(Channel channel){ 37 | return channel.attr(ChannelAttr.TAG).get(); 38 | } 39 | } -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/handler/CIMRequestHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.handler; 23 | 24 | /** 25 | * 请求处理接口,所有的请求实现必须实现此接口 26 | */ 27 | import com.farsunset.cim.model.SentBody; 28 | import io.netty.channel.Channel; 29 | 30 | public interface CIMRequestHandler { 31 | 32 | /** 33 | * 处理收到客户端从长链接发送的数据 34 | */ 35 | void process(Channel channel, SentBody body); 36 | } 37 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/Ping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.model; 23 | 24 | import com.farsunset.cim.constant.DataType; 25 | import com.fasterxml.jackson.annotation.JsonIgnore; 26 | 27 | import java.io.Serializable; 28 | 29 | /** 30 | * 服务端心跳请求 31 | */ 32 | public class Ping implements Serializable, Transportable { 33 | 34 | private static final long serialVersionUID = 1L; 35 | private static final String TAG = "PING"; 36 | private static final String DATA = "PING"; 37 | private static final Ping INSTANCE = new Ping(); 38 | 39 | private Ping() {} 40 | 41 | public static Ping getInstance() { 42 | return INSTANCE; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return TAG; 48 | } 49 | 50 | @Override 51 | public byte[] getBody() { 52 | return DATA.getBytes(); 53 | } 54 | 55 | @JsonIgnore 56 | @Override 57 | public DataType getType() { 58 | return DataType.PING; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/Pong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.model; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | * 客户端心跳响应 28 | */ 29 | public class Pong implements Serializable { 30 | 31 | private static final long serialVersionUID = 1L; 32 | private static final String TAG = "PONG"; 33 | private static final Pong INSTANCE = new Pong(); 34 | 35 | private Pong() { 36 | } 37 | 38 | public static Pong getInstance() { 39 | return INSTANCE; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return TAG; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/Transportable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 Xia Jun(3979434@qq.com). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | *************************************************************************************** 17 | * * 18 | * Website : http://www.farsunset.com * 19 | * * 20 | *************************************************************************************** 21 | */ 22 | package com.farsunset.cim.model; 23 | 24 | import com.farsunset.cim.constant.DataType; 25 | 26 | /** 27 | * 需要向另一端发送的结构体 28 | */ 29 | public interface Transportable { 30 | /** 31 | * 消息体字节数组 32 | * @return 33 | */ 34 | byte[] getBody(); 35 | 36 | /** 37 | * 消息类型 38 | * @return 39 | */ 40 | DataType getType(); 41 | } 42 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/proto/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.server.model.proto; 3 | option java_outer_classname="MessageProto"; 4 | message Model { 5 | int64 id = 1; 6 | string action = 2; 7 | string content = 3; 8 | string sender = 4; 9 | string receiver = 5; 10 | string extra = 6; 11 | string title = 7; 12 | string format = 8; 13 | int64 timestamp = 9; 14 | } 15 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/proto/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.server.model.proto; 3 | option java_outer_classname="ReplyBodyProto"; 4 | 5 | message Model { 6 | string key = 1; 7 | string code = 2; 8 | string message = 3; 9 | int64 timestamp =4; 10 | map data =5; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /cim-server-sdk/src/main/java/com/farsunset/cim/model/proto/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.server.model.proto; 3 | option java_outer_classname="SentBodyProto"; 4 | 5 | message Model { 6 | string key = 1; 7 | int64 timestamp =2; 8 | map data =3; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 33 5 | buildToolsVersion '33.0.0' 6 | 7 | defaultConfig { 8 | applicationId "com.farsunset.cim" 9 | minSdkVersion 23 10 | targetSdkVersion 33 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | /* 15 | CIM服务器 16 | */ 17 | buildConfigField("String", "CIM_API_URL", '"http://192.168.31.175:8080"') 18 | buildConfigField("String", "CIM_SERVER_HOST", '"192.168.31.175"') 19 | buildConfigField("Integer", "CIM_SERVER_PORT", '23456') 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | compileOptions { 29 | sourceCompatibility = '1.8' 30 | targetCompatibility = '1.8' 31 | } 32 | } 33 | 34 | dependencies { 35 | implementation "com.farsunset:cim-android-sdk:4.2.10" 36 | implementation 'androidx.appcompat:appcompat:1.6.0' 37 | implementation 'com.google.android.material:material:1.8.0' 38 | implementation 'androidx.annotation:annotation:1.3.0' 39 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 40 | implementation 'com.google.protobuf:protobuf-lite:3.0.1' 41 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' 42 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 43 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class **.R$* { *; } 2 | -optimizationpasses 5 3 | -dontusemixedcaseclassnames 4 | -dontskipnonpubliclibraryclasses 5 | -dontpreverify 6 | -verbose 7 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 8 | -dontwarn 9 | -dontskipnonpubliclibraryclassmembers 10 | -keepattributes *Annotation* 11 | -keepattributes Signature 12 | 13 | 14 | -dontwarn okio.** 15 | -dontwarn com.google.protobuf.** 16 | -dontwarn okhttp3.** 17 | 18 | -keep class com.google.protobuf.** { *; } 19 | -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase 20 | 21 | 22 | -keep class com.farsunset.cim.sdk.android.model.** {*;} 23 | 24 | -keep public class * extends android.content.ContentProvider 25 | -keep public class * extends android.app.AppCompatActivity 26 | -keep public class * extends android.app.Activity 27 | -keep public class * extends android.app.Fragment 28 | -keep public class * extends android.app.Application 29 | -keep public class * extends android.app.Service 30 | -keep public class * extends android.content.BroadcastReceiver 31 | 32 | 33 | -keepclassmembers class * extends android.webkit.WebChromeClient{ 34 | public void openFileChooser(...); 35 | } 36 | 37 | -keepclasseswithmembernames class * { 38 | native ; 39 | } 40 | 41 | -keepclasseswithmembers class * { 42 | public (android.content.Context, android.util.AttributeSet); 43 | } 44 | 45 | -keepclasseswithmembers class * { 46 | public (android.content.Context, android.util.AttributeSet, int); 47 | } 48 | 49 | -keepclassmembers class * extends android.app.Activity { 50 | public void *(android.view.View); 51 | } 52 | 53 | -keepclassmembers enum * { 54 | public static **[] values(); 55 | public static ** valueOf(java.lang.String); 56 | } 57 | 58 | -keep class * implements android.os.Parcelable { 59 | public static final android.os.Parcelable$Creator *; 60 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/adapter/holder/MessageViewHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2019 Xia Jun(3979434@qq.com). 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *

16 | * ************************************************************************************** 17 | * 18 | * Website : http://www.farsunset.com * 19 | * 20 | * ************************************************************************************** 21 | */ 22 | package com.farsunset.cim.adapter.holder; 23 | 24 | import android.view.View; 25 | import android.widget.TextView; 26 | 27 | import androidx.recyclerview.widget.RecyclerView; 28 | 29 | import com.farsunset.cim.R; 30 | 31 | 32 | public class MessageViewHolder extends RecyclerView.ViewHolder { 33 | public final TextView time; 34 | public final TextView content; 35 | public MessageViewHolder(View itemView) { 36 | super(itemView); 37 | time = itemView.findViewById(R.id.time); 38 | content = itemView.findViewById(R.id.content); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/data/LoginDataSource.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.data; 2 | 3 | import com.farsunset.cim.data.model.LoggedInUser; 4 | 5 | import java.io.IOException; 6 | 7 | /** 8 | * Class that handles authentication w/ login credentials and retrieves user information. 9 | */ 10 | public class LoginDataSource { 11 | 12 | public Result login(String username, String password) { 13 | 14 | try { 15 | // TODO: handle loggedInUser authentication 16 | LoggedInUser fakeUser = 17 | new LoggedInUser( 18 | java.util.UUID.randomUUID().toString(), 19 | "Jane Doe"); 20 | return new Result.Success<>(fakeUser); 21 | } catch (Exception e) { 22 | return new Result.Error(new IOException("Error logging in", e)); 23 | } 24 | } 25 | 26 | public void logout() { 27 | // TODO: revoke authentication 28 | } 29 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/data/LoginRepository.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.data; 2 | 3 | import com.farsunset.cim.data.model.LoggedInUser; 4 | 5 | /** 6 | * Class that requests authentication and user information from the remote data source and 7 | * maintains an in-memory cache of login status and user credentials information. 8 | */ 9 | public class LoginRepository { 10 | 11 | private static volatile LoginRepository instance; 12 | 13 | private LoginDataSource dataSource; 14 | 15 | // If user credentials will be cached in local storage, it is recommended it be encrypted 16 | // @see https://developer.android.com/training/articles/keystore 17 | private LoggedInUser user = null; 18 | 19 | // private constructor : singleton access 20 | private LoginRepository(LoginDataSource dataSource) { 21 | this.dataSource = dataSource; 22 | } 23 | 24 | public static LoginRepository getInstance(LoginDataSource dataSource) { 25 | if (instance == null) { 26 | instance = new LoginRepository(dataSource); 27 | } 28 | return instance; 29 | } 30 | 31 | public boolean isLoggedIn() { 32 | return user != null; 33 | } 34 | 35 | public void logout() { 36 | user = null; 37 | dataSource.logout(); 38 | } 39 | 40 | private void setLoggedInUser(LoggedInUser user) { 41 | this.user = user; 42 | // If user credentials will be cached in local storage, it is recommended it be encrypted 43 | // @see https://developer.android.com/training/articles/keystore 44 | } 45 | 46 | public Result login(String username, String password) { 47 | // handle login 48 | Result result = dataSource.login(username, password); 49 | if (result instanceof Result.Success) { 50 | setLoggedInUser(((Result.Success) result).getData()); 51 | } 52 | return result; 53 | } 54 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/data/Result.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.data; 2 | 3 | /** 4 | * A generic class that holds a result success w/ data or an error exception. 5 | */ 6 | public class Result { 7 | // hide the private constructor to limit subclass types (Success, Error) 8 | private Result() { 9 | } 10 | 11 | @Override 12 | public String toString() { 13 | if (this instanceof Result.Success) { 14 | Result.Success success = (Result.Success) this; 15 | return "Success[data=" + success.getData().toString() + "]"; 16 | } else if (this instanceof Result.Error) { 17 | Result.Error error = (Result.Error) this; 18 | return "Error[exception=" + error.getError().toString() + "]"; 19 | } 20 | return ""; 21 | } 22 | 23 | // Success sub-class 24 | public final static class Success extends Result { 25 | private T data; 26 | 27 | public Success(T data) { 28 | this.data = data; 29 | } 30 | 31 | public T getData() { 32 | return this.data; 33 | } 34 | } 35 | 36 | // Error sub-class 37 | public final static class Error extends Result { 38 | private Exception error; 39 | 40 | public Error(Exception error) { 41 | this.error = error; 42 | } 43 | 44 | public Exception getError() { 45 | return this.error; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/data/model/LoggedInUser.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.data.model; 2 | 3 | /** 4 | * Data class that captures user information for logged in users retrieved from LoginRepository 5 | */ 6 | public class LoggedInUser { 7 | 8 | private String userId; 9 | private String displayName; 10 | 11 | public LoggedInUser(String userId, String displayName) { 12 | this.userId = userId; 13 | this.displayName = displayName; 14 | } 15 | 16 | public String getUserId() { 17 | return userId; 18 | } 19 | 20 | public String getDisplayName() { 21 | return displayName; 22 | } 23 | } -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/java/com/farsunset/cim/http/MessageService.java: -------------------------------------------------------------------------------- 1 | package com.farsunset.cim.http; 2 | 3 | 4 | import retrofit2.Call; 5 | import retrofit2.http.Field; 6 | import retrofit2.http.FormUrlEncoded; 7 | import retrofit2.http.POST; 8 | 9 | public interface MessageService { 10 | 11 | @POST("/api/message/send") 12 | @FormUrlEncoded 13 | Call send(@Field("sender") String sender, 14 | @Field("receiver") String receiver, 15 | @Field("action") String action, 16 | @Field("content") String content); 17 | } 18 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/app_login_bg_compat.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/dialog_edit_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/dialog_material_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/edit_background_corners.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/icon_menu_send.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 21 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/drawable/login_content_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/layout/activity_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/layout/item_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 20 | 21 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/menu/send.xml: -------------------------------------------------------------------------------- 1 |

3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/app_splash_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/app_splash_background.jpg -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #333333 4 | #666666 5 | #999999 6 | #e5e5e5 7 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | cim客户端 3 | 4 | Email 5 | Password 6 | Sign in or register 7 | Sign in 8 | "Welcome !" 9 | Not a valid username 10 | Password must be >5 characters 11 | "Login failed" 12 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 17 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/app/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | mavenCentral() 6 | maven{ url'https://maven.aliyun.com/repository/central' } 7 | maven{ url'https://maven.aliyun.com/repository/google' } 8 | maven{ url'https://maven.aliyun.com/repository/public' } 9 | maven{ url'https://maven.aliyun.com/repository/gradle-plugin' } 10 | maven { url "https://jitpack.io" } 11 | } 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:7.4.0' 14 | } 15 | } 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | mavenCentral() 21 | maven { url "https://jitpack.io" } 22 | maven{ url'https://maven.aliyun.com/repository/central' } 23 | maven{ url'https://maven.aliyun.com/repository/google' } 24 | maven{ url'https://maven.aliyun.com/repository/public' } 25 | maven{ url'https://maven.aliyun.com/repository/gradle-plugin' } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | android.injected.testOnly=false 21 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 15 10:18:48 CST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "cim-client-android" -------------------------------------------------------------------------------- /cim-use-examples/cim-client-vue/Auto.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 50 | 51 | 54 | -------------------------------------------------------------------------------- /cim-use-examples/cim-client-vue/README.txt: -------------------------------------------------------------------------------- 1 | ## 注意!! 2 | 启动本本目录index.html 请确定服务端参数配置值为如下 3 | cim.websocket.protocol=protobuf 4 | 5 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#ErmDP 6 | 7 | 8 | 9 | ## 客户端文档 10 | https://www.yuque.com/yuanfangxiyang/ma4ytb/zwkr3m#oaLfQ 11 | 12 | ## 服务端配置 13 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#XAbTx -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/README.txt: -------------------------------------------------------------------------------- 1 | ## 注意!! 2 | 启动本本目录index.html 请确定服务端参数配置值为如下 3 | cim.websocket.protocol=json 4 | 5 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#srHdB 6 | 7 | 8 | ## 客户端文档 9 | https://www.yuque.com/yuanfangxiyang/ma4ytb/zwkr3m#lE1R2 10 | 11 | ## 服务端配置 12 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#XAbTx -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/image/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/image/icon.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/image/icon_loading_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/image/icon_loading_small.gif -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-json/image/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-json/image/pattern.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/README.txt: -------------------------------------------------------------------------------- 1 | ## 注意!! 2 | 启动本本目录index.html 请确定服务端参数配置值为如下 3 | cim.websocket.protocol=protobuf 4 | 5 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#ErmDP 6 | 7 | 8 | 9 | ## 客户端文档 10 | https://www.yuque.com/yuanfangxiyang/ma4ytb/zwkr3m#oaLfQ 11 | 12 | ## 服务端配置 13 | https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz#XAbTx -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/image/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/image/icon.png -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/image/icon_loading_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/image/icon_loading_small.gif -------------------------------------------------------------------------------- /cim-use-examples/cim-client-web-protobuf/image/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/cim-use-examples/cim-client-web-protobuf/image/pattern.png -------------------------------------------------------------------------------- /doc/proto/c#.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/c#.zip -------------------------------------------------------------------------------- /doc/proto/c#/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /doc/proto/c#/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/c#/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /doc/proto/c++.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/c++.zip -------------------------------------------------------------------------------- /doc/proto/c++/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /doc/proto/c++/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/c++/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /doc/proto/js/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.web.model; 3 | message Message { 4 | int64 id = 1; 5 | string action = 2; 6 | string content = 3; 7 | string sender = 4; 8 | string receiver = 5; 9 | string extra = 6; 10 | string title = 7; 11 | string format = 8; 12 | int64 timestamp = 9; 13 | } 14 | -------------------------------------------------------------------------------- /doc/proto/js/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.web.model; 3 | message ReplyBody { 4 | string key = 1; 5 | string code = 2; 6 | string message = 3; 7 | int64 timestamp =4; 8 | map data =5; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /doc/proto/js/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.farsunset.cim.sdk.web.model; 3 | 4 | message SentBody { 5 | string key = 1; 6 | int64 timestamp =2; 7 | map data =3; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/js/说明.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/js/说明.txt -------------------------------------------------------------------------------- /doc/proto/objective-c.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/objective-c.zip -------------------------------------------------------------------------------- /doc/proto/objective-c/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /doc/proto/objective-c/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/objective-c/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /doc/proto/other.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/other.zip -------------------------------------------------------------------------------- /doc/proto/other/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /doc/proto/other/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/other/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /doc/proto/other/说明.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/other/说明.txt -------------------------------------------------------------------------------- /doc/proto/python.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/farsunset/cim/173d13fe87ccc595b5a1c4580b57a363e7d2f6d2/doc/proto/python.zip -------------------------------------------------------------------------------- /doc/proto/python/Message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | int64 id = 1; 4 | string action = 2; 5 | string content = 3; 6 | string sender = 4; 7 | string receiver = 5; 8 | string extra = 6; 9 | string title = 7; 10 | string format = 8; 11 | int64 timestamp = 9; 12 | } 13 | -------------------------------------------------------------------------------- /doc/proto/python/ReplyBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | string code = 2; 5 | string message = 3; 6 | int64 timestamp =4; 7 | map data =5; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /doc/proto/python/SentBody.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | message Model { 3 | string key = 1; 4 | int64 timestamp =2; 5 | map data =3; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /doc/在线文档.txt: -------------------------------------------------------------------------------- 1 | https://www.yuque.com/yuanfangxiyang/ma4ytb --------------------------------------------------------------------------------