@@ -33,28 +33,28 @@ open class PhxSocket(
3333 // Public Attributes
3434 // ------------------------------------------------------------------------------
3535 /* * Timeout to use when opening connections */
36- public var timeout: Long = DEFAULT_TIMEOUT
36+ var timeout: Long = DEFAULT_TIMEOUT
3737
3838 /* * Interval between sending a heartbeat */
39- public var heartbeatIntervalMs: Long = DEFAULT_HEARTBEAT
39+ var heartbeatIntervalMs: Long = DEFAULT_HEARTBEAT
4040
4141 /* * Interval between socket reconnect attempts */
42- public var reconnectAfterMs: ((tries: Int ) -> Long ) = closure@{
42+ var reconnectAfterMs: ((tries: Int ) -> Long ) = closure@{
4343 return @closure if (it >= 3 ) 100000 else longArrayOf(1000 , 2000 , 5000 )[it]
4444 }
4545
4646 /* * Hook for custom logging into the client */
47- public var logger: ((msg: String ) -> Unit )? = null
47+ var logger: ((msg: String ) -> Unit )? = null
4848
4949 /* * Disable sending Heartbeats by setting to true */
50- public var skipHeartbeat: Boolean = false
50+ var skipHeartbeat: Boolean = false
5151
5252 /* *
5353 * Socket will attempt to reconnect if the Socket was closed. Will not
5454 * reconnect if the Socket errored (e.g. connection refused.) Default
5555 * is set to true
5656 */
57- public var autoReconnect: Boolean = true
57+ var autoReconnect: Boolean = true
5858
5959
6060 // ------------------------------------------------------------------------------
@@ -140,13 +140,13 @@ open class PhxSocket(
140140 // Public
141141 // ------------------------------------------------------------------------------
142142 /* * True if the Socket is currently connected */
143- public val isConnected: Boolean
143+ val isConnected: Boolean
144144 get() = connection != null
145145
146146 /* *
147147 * Disconnects the Socket
148148 */
149- public fun disconnect () {
149+ fun disconnect () {
150150 connection?.close(1000 , null )
151151 connection = null
152152
@@ -157,7 +157,7 @@ open class PhxSocket(
157157 * will be sent through the connection. If the Socket is already connected,
158158 * then this call will be ignored.
159159 */
160- public fun connect () {
160+ fun connect () {
161161 // Do not attempt to reconnect if already connected
162162 if (isConnected) return
163163 connection = client.newWebSocket(request, this )
@@ -173,7 +173,7 @@ open class PhxSocket(
173173 *
174174 * @param callback: Callback to register
175175 */
176- public fun onOpen (callback : () -> Unit ) {
176+ fun onOpen (callback : () -> Unit ) {
177177 this .onOpenCallbacks.add(callback)
178178 }
179179
@@ -188,7 +188,7 @@ open class PhxSocket(
188188 *
189189 * @param callback: Callback to register
190190 */
191- public fun onClose (callback : () -> Unit ) {
191+ fun onClose (callback : () -> Unit ) {
192192 this .onCloseCallbacks.add(callback)
193193 }
194194
@@ -202,7 +202,7 @@ open class PhxSocket(
202202 *
203203 * @param callback: Callback to register
204204 */
205- public fun onError (callback : (Throwable ? , Response ? ) -> Unit ) {
205+ fun onError (callback : (Throwable ? , Response ? ) -> Unit ) {
206206 this .onErrorCallbacks.add(callback)
207207 }
208208
@@ -216,7 +216,7 @@ open class PhxSocket(
216216 *
217217 * @param callback: Callback to register
218218 */
219- public fun onMessage (callback : (PhxMessage ) -> Unit ) {
219+ fun onMessage (callback : (PhxMessage ) -> Unit ) {
220220 this .onMessageCallbacks.add(callback)
221221 }
222222
@@ -226,7 +226,7 @@ open class PhxSocket(
226226 * call this method when you are finished when the Socket in order to release
227227 * any references held by the socket.
228228 */
229- public fun removeAllCallbacks () {
229+ fun removeAllCallbacks () {
230230 this .onOpenCallbacks.clear()
231231 this .onCloseCallbacks.clear()
232232 this .onErrorCallbacks.clear()
@@ -237,7 +237,7 @@ open class PhxSocket(
237237 * Removes the Channel from the socket. This does not cause the channel to inform
238238 * the server that it is leaving so you should call channel.leave() first.
239239 */
240- public fun remove (channel : PhxChannel ) {
240+ fun remove (channel : PhxChannel ) {
241241 this .channels = channels
242242 .filter { it.joinRef != channel.joinRef }
243243 .toMutableList()
@@ -249,7 +249,7 @@ open class PhxSocket(
249249 * Example:
250250 * val channel = socket.channel("rooms", params)
251251 */
252- public fun channel (topic : String , params : Payload ? = null): PhxChannel {
252+ fun channel (topic : String , params : Payload ? = null): PhxChannel {
253253 val channel = PhxChannel (topic, params ? : HashMap (), this )
254254 this .channels.add(channel)
255255 return channel
@@ -258,14 +258,14 @@ open class PhxSocket(
258258 /* *
259259 * Sends data through the Socket
260260 */
261- public open fun push (topic : String ,
262- event : String ,
263- payload : Payload ,
264- ref : String? = null,
265- joinRef : String? = null) {
261+ open fun push (topic : String ,
262+ event : String ,
263+ payload : Payload ,
264+ ref : String? = null,
265+ joinRef : String? = null) {
266266
267267 val callback: (() -> Unit ) = {
268- var body: MutableMap <String , Any > = HashMap ()
268+ val body: MutableMap <String , Any > = HashMap ()
269269 body[" topic" ] = topic
270270 body[" event" ] = event
271271 body[" payload" ] = payload
@@ -294,7 +294,7 @@ open class PhxSocket(
294294 /* *
295295 * @return the next message ref, accounting for overflows
296296 */
297- public open fun makeRef (): String {
297+ open fun makeRef (): String {
298298 val newRef = this .ref + 1
299299 this .ref = if (newRef == Int .MAX_VALUE ) 0 else newRef
300300
0 commit comments