Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RxWebSocket
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Android Widget
RxWebSocket
Commits
494de908
Commit
494de908
authored
May 16, 2022
by
王雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在dispose()中执行前先判断是否已经 被isDispose()
parent
446366cf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
README.md
README.md
+1
-0
build.gradle
websocket/build.gradle
+1
-1
WebSocketSubscriber.java
.../src/main/java/com/dhh/websocket/WebSocketSubscriber.java
+4
-4
No files found.
README.md
View file @
494de908
...
...
@@ -21,6 +21,7 @@ Gradle:
```
## 说明
v1.0.3 在dispose()中执行前先判断是否已经 被isDispose() 见WebSocketSubscriber.kt -> void dispose() // 2022 05 13
v1.0.2 在dispose()中手动close webSocket
v1.0.1 版本移除调试代码
...
...
websocket/build.gradle
View file @
494de908
...
...
@@ -102,7 +102,7 @@ task generateSourcesJar(type: Jar) {
from
android
.
sourceSets
.
main
.
java
.
srcDirs
classifier
'sources'
}
def
versionName
=
'1.0.
2
'
def
versionName
=
'1.0.
3
'
def
SNAPSHOT_REPOSITORY_URL
=
"https://hub.zmcms.cn/repository/maven-snapshots/"
def
RELEASE_REPOSITORY_URL
=
"https://hub.zmcms.cn/repository/maven-releases/"
...
...
websocket/src/main/java/com/dhh/websocket/WebSocketSubscriber.java
View file @
494de908
...
...
@@ -7,7 +7,6 @@ import okhttp3.WebSocket;
import
okio.ByteString
;
/**
*
* @author dhh
* @date 2017/10/24
* <p>
...
...
@@ -19,7 +18,8 @@ import okio.ByteString;
public
abstract
class
WebSocketSubscriber
implements
Observer
<
WebSocketInfo
>
{
private
boolean
hasOpened
;
protected
Disposable
disposable
;
private
WebSocket
mWebSocket
;
private
WebSocket
mWebSocket
;
@Override
public
final
void
onNext
(
@NonNull
WebSocketInfo
webSocketInfo
)
{
if
(
webSocketInfo
.
isOnOpen
())
{
...
...
@@ -64,10 +64,10 @@ public abstract class WebSocketSubscriber implements Observer<WebSocketInfo> {
}
public
final
void
dispose
()
{
if
(
disposable
!=
null
)
{
if
(
disposable
!=
null
&&
!
disposable
.
isDisposed
()
)
{
disposable
.
dispose
();
}
if
(
mWebSocket
!=
null
)
{
if
(
mWebSocket
!=
null
)
{
mWebSocket
.
close
(
3000
,
"close WebSocket"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment