Skip to content

Commit 11f8ed0

Browse files
committed
prepare 0.5.0
1 parent 53265a9 commit 11f8ed0

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JavaPhoenixClient
22

3-
[![Download](https://api.bintray.com/packages/drees/java-phoenix-client/JavaPhoenixClient/images/download.svg) ](https://bintray.com/drees/java-phoenix-client/JavaPhoenixClient/_latestVersion)
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.github.dsrees/JavaPhoenixClient.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.dsrees%22%20AND%20a:%22JavaPhoenixClient%22)
44
[![Build Status](https://travis-ci.com/dsrees/JavaPhoenixClient.svg?branch=master)](https://travis-ci.com/dsrees/JavaPhoenixClient)
55
[![codecov](https://codecov.io/gh/dsrees/JavaPhoenixClient/branch/master/graph/badge.svg)](https://codecov.io/gh/dsrees/JavaPhoenixClient)
66

@@ -39,20 +39,47 @@ fun connectToChatRoom() {
3939
}
4040
```
4141

42-
You can also inject your own OkHttp Client into the Socket to provide your own configuration
42+
43+
If you need to provide dynamic parameters that can change between calls to `connect()`, then you can pass a closure to the constructor
44+
45+
```kotlin
46+
47+
// Create the Socket
48+
var authToken = "abc"
49+
val socket = Socket("http://localhost:4000/socket/websocket", { mapOf("token" to authToken) })
50+
51+
// Connect with query parameters "?token=abc"
52+
socket.connect()
53+
54+
55+
// later in time, connect with query parameters "?token=xyz"
56+
authToken = "xyz"
57+
socket.connect() // or internal reconnect logic kicks in
58+
```
59+
60+
61+
You can also inject your own OkHttp Client and GSON into the Socket to provide your own configuration
4362
```kotlin
44-
// Create the Socket with a pre-configured OkHttp Client
63+
64+
// Configure your own GSON instance
65+
val gson = Gson.Builder().create()
66+
67+
// Configure your own OkHttp Client
4568
val client = OkHttpClient.Builder()
4669
.connectTimeout(1000, TimeUnit.MILLISECONDS)
4770
.build()
4871

72+
// Create Socket with your custom instances
4973
val params = hashMapOf("token" to "abc123")
5074
val socket = Socket("http://localhost:4000/socket/websocket",
5175
params,
76+
gson,
5277
client)
5378
```
5479

5580

81+
82+
5683
### Installation
5784

5885
JavaPhoenixClient is hosted on MavenCentral. You'll need to make sure you declare `mavenCentral()` as one of your repositories
@@ -66,13 +93,13 @@ repositories {
6693
and then add the library. See [releases](https://github.com/dsrees/JavaPhoenixClient/releases) for the latest version
6794
```$xslt
6895
dependencies {
69-
implementation 'com.github.dsrees:JavaPhoenixClient:0.4.1'
96+
implementation 'com.github.dsrees:JavaPhoenixClient:0.5.0'
7097
}
7198
```
7299

73100

74101
### Feedback
75-
Please submit in issue if you have any problems!
102+
Please submit in issue if you have any problems or questions! PRs are also welcome.
76103

77104

78105
This library is built to mirror the [phoenix.js](https://hexdocs.pm/phoenix/js/) and [SwiftPhoenixClient](https://github.com/davidstump/SwiftPhoenixClient) libraries.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ apply plugin: "org.jetbrains.dokka"
2525
apply plugin: "com.vanniktech.maven.publish"
2626

2727
group 'com.github.dsrees'
28-
version '0.4.1'
28+
version '0.5.0'
2929

3030
sourceCompatibility = 1.8
3131

0 commit comments

Comments
 (0)