Skip to content

Commit c313eec

Browse files
committed
netty-learning
1 parent cea4ff1 commit c313eec

File tree

525 files changed

+29958
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+29958
-0
lines changed

.idea/workspace.xml

+993
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

netty-10-nio-multi-port-chat/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 25 21:31:13 CST 2019
2+
gradle.version=5.3

netty-10-nio-multi-port-chat/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.

netty-11-wxq-websocket-socket-chat/.gradle/5.3/gc.properties

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 25 21:37:11 CST 2019
2+
gradle.version=5.3

netty-11-wxq-websocket-socket-chat/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en">
3+
<head>
4+
<title>mly-聊天室</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6+
<!-- jquery -->
7+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
8+
<!-- bootstrap -->
9+
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css"/>
10+
<script type="text/javascript" src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
11+
</head>
12+
<body>
13+
<h1 style="float: left">明理苑-聊天室</h1>
14+
<div>
15+
<form onsubmit="return false">
16+
<!-- <div class="form-group">-->
17+
<textarea class="form-control" rows="10" id="textArea"></textarea>
18+
<input name="msg" type="text" class="form-control" id="inputArea"/>
19+
<button type="submit" class="btn" id="button1">发送</button>
20+
<!-- </div>-->
21+
</form>
22+
23+
</div>
24+
</body>
25+
<script >
26+
27+
$('#button1').on('click', sendMsg());
28+
var socket;
29+
if(window.WebSocket){
30+
socket = new WebSocket("ws://localhost:8089/");
31+
socket.onclose = function () {
32+
var text = document.getElementById("textArea");
33+
text.value = text.value+"\n"+"连接关闭!";
34+
};
35+
socket.onmessage = function (event) {
36+
var text = document.getElementById("textArea");
37+
text.value = text.value+"\n"+event.data;
38+
};
39+
socket.onopen = function () {
40+
var text = document.getElementById("textArea");
41+
text.value = "连接开启!";
42+
}
43+
}else {
44+
alert("浏览器不支持websocket!")
45+
}
46+
47+
function sendMsg() {
48+
return function () {
49+
var msg = document.getElementById("inputArea").value;
50+
console.log(msg)
51+
if(!window.WebSocket||msg==null||msg==""){
52+
alert("msg不能为空");
53+
return;
54+
}
55+
if(socket.readyState==WebSocket.OPEN){
56+
// alert(msg);
57+
socket.send(msg);
58+
}else {
59+
alert("连接未开启!")
60+
}
61+
}
62+
}
63+
</script>
64+
</html>
Binary file not shown.
Binary file not shown.

netty-2-socket/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 11 08:53:07 CST 2019
2+
gradle.version=5.3

netty-2-socket/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.

netty-3-mult-client/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 11 09:19:32 CST 2019
2+
gradle.version=5.3

netty-3-mult-client/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

netty-4-heartBeat/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 11 12:53:21 CST 2019
2+
gradle.version=5.3

netty-4-heartBeat/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

netty-5-websocket/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Fri Oct 11 13:14:44 CST 2019
2+
gradle.version=5.3

netty-5-websocket/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

netty-6-google-protobuf/.gradle/5.3/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Sat Oct 12 21:36:22 CST 2019
2+
gradle.version=5.3

netty-6-google-protobuf/.gradle/vcs-1/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
// Protocol Buffers - Google's data interchange format
2+
// Copyright 2008 Google Inc. All rights reserved.
3+
// https://developers.google.com/protocol-buffers/
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
// * Redistributions in binary form must reproduce the above
12+
// copyright notice, this list of conditions and the following disclaimer
13+
// in the documentation and/or other materials provided with the
14+
// distribution.
15+
// * Neither the name of Google Inc. nor the names of its
16+
// contributors may be used to endorse or promote products derived from
17+
// this software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
syntax = "proto3";
32+
33+
package google.protobuf;
34+
35+
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36+
option go_package = "github.com/golang/protobuf/ptypes/any";
37+
option java_package = "com.google.protobuf";
38+
option java_outer_classname = "AnyProto";
39+
option java_multiple_files = true;
40+
option objc_class_prefix = "GPB";
41+
42+
// `Any` contains an arbitrary serialized protocol buffer message along with a
43+
// URL that describes the type of the serialized message.
44+
//
45+
// Protobuf library provides support to pack/unpack Any values in the form
46+
// of utility functions or additional generated methods of the Any type.
47+
//
48+
// Example 1: Pack and unpack a message in C++.
49+
//
50+
// Foo foo = ...;
51+
// Any any;
52+
// any.PackFrom(foo);
53+
// ...
54+
// if (any.UnpackTo(&foo)) {
55+
// ...
56+
// }
57+
//
58+
// Example 2: Pack and unpack a message in Java.
59+
//
60+
// Foo foo = ...;
61+
// Any any = Any.pack(foo);
62+
// ...
63+
// if (any.is(Foo.class)) {
64+
// foo = any.unpack(Foo.class);
65+
// }
66+
//
67+
// Example 3: Pack and unpack a message in Python.
68+
//
69+
// foo = Foo(...)
70+
// any = Any()
71+
// any.Pack(foo)
72+
// ...
73+
// if any.Is(Foo.DESCRIPTOR):
74+
// any.Unpack(foo)
75+
// ...
76+
//
77+
// The pack methods provided by protobuf library will by default use
78+
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
79+
// methods only use the fully qualified type name after the last '/'
80+
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
81+
// name "y.z".
82+
//
83+
//
84+
// JSON
85+
// ====
86+
// The JSON representation of an `Any` value uses the regular
87+
// representation of the deserialized, embedded message, with an
88+
// additional field `@type` which contains the type URL. Example:
89+
//
90+
// package google.profile;
91+
// message Person {
92+
// string first_name = 1;
93+
// string last_name = 2;
94+
// }
95+
//
96+
// {
97+
// "@type": "type.googleapis.com/google.profile.Person",
98+
// "firstName": <string>,
99+
// "lastName": <string>
100+
// }
101+
//
102+
// If the embedded message type is well-known and has a custom JSON
103+
// representation, that representation will be embedded adding a field
104+
// `value` which holds the custom JSON in addition to the `@type`
105+
// field. Example (for message [google.protobuf.Duration][]):
106+
//
107+
// {
108+
// "@type": "type.googleapis.com/google.protobuf.Duration",
109+
// "value": "1.212s"
110+
// }
111+
//
112+
message Any {
113+
// A URL/resource name whose content describes the type of the
114+
// serialized protocol buffer message.
115+
//
116+
// For URLs which use the scheme `http`, `https`, or no scheme, the
117+
// following restrictions and interpretations apply:
118+
//
119+
// * If no scheme is provided, `https` is assumed.
120+
// * The last segment of the URL's path must represent the fully
121+
// qualified name of the type (as in `path/google.protobuf.Duration`).
122+
// The name should be in a canonical form (e.g., leading "." is
123+
// not accepted).
124+
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
125+
// value in binary format, or produce an error.
126+
// * Applications are allowed to cache lookup results based on the
127+
// URL, or have them precompiled into a binary to avoid any
128+
// lookup. Therefore, binary compatibility needs to be preserved
129+
// on changes to types. (Use versioned type names to manage
130+
// breaking changes.)
131+
//
132+
// Schemes other than `http`, `https` (or the empty scheme) might be
133+
// used with implementation specific semantics.
134+
//
135+
string type_url = 1;
136+
137+
// Must be a valid serialized protocol buffer of the above specified type.
138+
bytes value = 2;
139+
}

0 commit comments

Comments
 (0)