Comments (45)
Hello again @Mahdimm,
I don't know why but on my 1.2.5 version, could not get the new code base on the cocoapods. I just upgrade the new version as 1.2.7, it should be soon available. I will re-write when it is published.
from stompclientlib.
Hey @Mahdimm,
Can you update the StompClientLib pod and try again? That was totally my mistake to did not update code base. Sorry :)
from stompclientlib.
Hello, I had the same problem in my fork (I'm building a nativescript plugin with it and I had to do some changes) and I've solved in this way:
public func disconnect() {
if socket != nil {
connection = false
var headerToSend = [String: String]()
headerToSend[StompCommands.commandDisconnect] = String(Int(NSDate().timeIntervalSince1970))
sendFrame(command: StompCommands.commandDisconnect, header: headerToSend, body: nil)
socket!.close()
socket!.delegate = nil
socket = nil
}
}
basically I close the socket, nil the delegate and then nil the socket itself (so it will be recreated).
Hope this help
Dem
from stompclientlib.
@gloryluu @demetrio812 Thank you so much for this contribution. I've added this to new version. Also, autoreconnect feature is going to be in this version after the tests are done :)
from stompclientlib.
Hello @MrShafiee,
Let's figure out what your problem is. I cannot understand what the error is with that image, can you post the console error?
from stompclientlib.
There is no feature for subscrition delegate method but it is the first feature is going to work on it. It will be available soon :) I'm working on it.
Do you have any problem?
from stompclientlib.
@WrathChaos sorry for waiting. I was so busy all last week. Do you know, it works good in simple example now. I think, maybe something wrong with our backend. Any way, thanks for your work!:+1: Good luck:slightly_smiling_face:
from stompclientlib.
Hello @gloryluu,
Can you check that did "stompClientDidDisconnect" delegate is called after you disconnect the socket? If it is not called then please check your disconnect method :)
Please give me feedback,
Have fun!
from stompclientlib.
Yes it did.
Make some debug, I notice that after I call the method 'closeConnection', when I tried to reconnect, in file StompCLientLib, in the method 'openSocketWithURLRequest' the client is not NULL and the socket?.readyState is not CLOSED. So it never come inside.
from stompclientlib.
@gloryluu I'm gonna check when I have time, let me some days :)
from stompclientlib.
Hello guys,
New version is alive, 1.2.5, please try it and give me a feedback about this issue :) For now, I closed this issue.
Have fun
from stompclientlib.
hi @WrathChaos
thanks for this awsome library
did you fix this problem?
from stompclientlib.
Hello @Mahdimm,
Yes, it should be fixed on new version. If you still have problem, please give me a feedback about it and we can solve it together :)
Have fun
from stompclientlib.
thanks of replying @WrathChaos
first time we connect its ok and if we try to disconnect also it works but readyState of socket property in StompClient object doesn't change to .CLOSED and it is still .OPEN, thus when we try to connect socket for second time it could not register. what should we do now?
from stompclientlib.
@Mahdimm
Does it still a problem on 1.2.5 version? Also, have you tried auto reconnect or auto disconnect features together? I tried them at the same time for testing disconnect and reconnect issues and it was working well.
from stompclientlib.
@WrathChaos
Yes, I work with 1.2.5 version.
Do you means that there are functions autoReconnect and autoDisconnect? because I could not find them!
At first, I used this function for register Socket :
func registerSocket( _ token:String ){
let baseURL = "ws://MYIPADDRESS:5050/stomp"
let completedWSURL = "\(baseURL)?access_token=\(token)"
let url = NSURL(string: completedWSURL)!
socketClient.openSocketWithURLRequest(request: NSURLRequest(url: url as URL) , delegate: self as StompClientLibDelegate)
}
and the use this function for disconnect:
socketClient.disconnect()
and for the second time use registerSocket() function to connect with new token but it could not register, for that reason I mentioned before!
from stompclientlib.
@Mahdimm Let me test fast. While I'm testing, can you please try to use reconnect function. Here is the example of it :
// Reconnect after 4 sec
socketClient.reconnect(request: NSURLRequest(url: url as URL) , delegate: self as StompClientLibDelegate, time: 4.0)
from stompclientlib.
@WrathChaos
I didn't see any function like reconnect
can you tell me the name of file?
thanks
from stompclientlib.
@Mahdimm I guess you could not update the library itself.
Can you please delete the line of StompClientLib and pod install, then again write as :
pod StompClientLib
and again run pod install command on your terminal.
You can even check the new feature functions on ReadME file or StompClientLib in itself.
Also, I tried your use case on my test environment it works well. Please give me a feedback about your issue when you're done these steps :)
from stompclientlib.
@WrathChaos
I did you're solution and version is 1.2.5 but we didn't found any function as you said.
look at this image:
this image
thanks
from stompclientlib.
@Mahdimm
Working on it :)
from stompclientlib.
@WrathChaos
Thanks
Im waiting for reply
from stompclientlib.
Hey @WrathChaos ,
Thanks for your response, yes it was updated successfully to 1.2.7 version, and reconnect function is available; But now when I want use openSocketWithURLRequest() my up crashed!
This image
from stompclientlib.
Hello @WrathChaos ,
There is not any error on console log, I got it on simulator, but every thing is okey on real device.
and I have another question, is there any delegate function notify us when we subscribe on any destination?
Thanks.
from stompclientlib.
Hi @WrathChaos
did you add delegate for subscribe & unSubscribe?
thanks for supporting
from stompclientlib.
Hey @Mahdimm,
Unfortunately, I did not have time to add these delegates but this feature is the first place to do.
I will add them for the next update and it is going to be available within a week.
Also, PR is always welcome :)
from stompclientlib.
@WrathChaos should the StompClientDidConnect delegate be called on connect/reconnect using autoreconnect method? (it is not for me)
Another question - is it possible to get following delegate somehow? - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
Getting just call to stompClientDidDisconnect(client:) delegate in that case.
from stompclientlib.
Hi @deni2s,
Which version of the library are you using? (For the first question)
I am going to work on the new delegate methods ASAP. Still trying to make time for working on it.
from stompclientlib.
@WrathChaos I am using the latest version.
from stompclientlib.
@deni2s
Can you try the example? Every delegate is working with the example on my side. Each time auto-reconnect and disconnect. Its delegate gives me the console.log
from stompclientlib.
Hey @WrathChaos, thanks for this library, I try to use this, but unfortunately, none of the delegate is calling on my end. Not sure what I am missing!! I can see the log "WebSocket is connected" from the library, but my delegate method func stompClientDidConnect(client: StompClientLib!)
is not calling. Did I need to add anything else?
from stompclientlib.
@WrathChaos couldn't get the Example to work at all, looks like pod file is outdated (no target platform defined, no minimum ios version defined).
from stompclientlib.
@gsathish02 and @deni2s , I'm working on it. I'm going to fix it tonight.
from stompclientlib.
Sorry guys could not make time for it. Before this weekend I will fix it.
from stompclientlib.
Hey guys @gsathish02 and @deni2s,
I've tested with my spring boot server. It totally works. I've used Java 8 on MacOS. Can you provide me with a test link?
from stompclientlib.
Also, I've closed this issue, please re-open for your issues and let's continue on there.
from stompclientlib.
Hello, I have save issue,
When I run example project it work as expected,
But if I create new project and copy/paste same code, delegate method stompClientDidConnect not called.
from stompclientlib.
@xaeroolj Let's continue on your issue, please :)
from stompclientlib.
Hello. I have same problem too. I have log "WebSocket is connected", but delegate method stompClientDidConnect has called no where. Maybe it should be called in func webSocketDidOpen(_ webSocket: SRWebSocket!), where is print "WebSocket is connected"?
from stompclientlib.
Hello @4egoshev, Can you tell me which version are you using?
from stompclientlib.
I use 1.3.1 version
from stompclientlib.
@4egoshev Can you try with the latest release, please? (Currently 1.3.5)
from stompclientlib.
@WrathChaos sorry, but it does not solve my problem
from stompclientlib.
@4egoshev Can you provide me with a simple example on a repo?
from stompclientlib.
@4egoshev Love to hear that, I hope you can make it work. Have fun :)
from stompclientlib.
Related Issues (20)
- Subscribe response HOT 3
- How can I access http response header (handshakeResponseHeaders) about handshaking? HOT 1
- Disconnecting after using autoReconnect HOT 15
- Add openSocketWithURLRequest connectionheader to websocket urlRequest's HTTPHeaderField and request additional connect function. HOT 4
- Cannot connect to socket HOT 3
- Error Domain=SRWebSocketErrorDomain Code=2132 "received bad response code from server 403" HOT 4
- Add method/flag to stop logging HOT 6
- Subscribe Issue HOT 3
- Version 2.0 HOT 12
- Received bad response code from server 403 HOT 4
- Error Domain=SRWebSocketErrorDomain Code=2132 "received bad response code from server 403" HOT 3
- Socket Disconnect after 30 min HOT 5
- misprint in code HOT 3
- Support for WatchOS HOT 2
- Swift Package Manager support? HOT 2
- Connection variable is not set to false when WebSocket receives DISCONNECT HOT 1
- Auto disconnection with error code 4500 HOT 2
- Facing Issue while sending the message HOT 1
- Privacy Manifest HOT 6
- Swift Package Manager Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stompclientlib.