GithubHelp home page GithubHelp logo

Comments (45)

WrathChaos avatar WrathChaos commented on July 17, 2024 2

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.

WrathChaos avatar WrathChaos commented on July 17, 2024 2

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.

demetrio812 avatar demetrio812 commented on July 17, 2024 1

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.

WrathChaos avatar WrathChaos commented on July 17, 2024 1

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024 1

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.

WrathChaos avatar WrathChaos commented on July 17, 2024 1

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.

dev-lis avatar dev-lis commented on July 17, 2024 1

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

starlight173 avatar starlight173 commented on July 17, 2024

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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@gloryluu I'm gonna check when I have time, let me some days :)

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

Mahdimm avatar Mahdimm commented on July 17, 2024

hi @WrathChaos
thanks for this awsome library
did you fix this problem?

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

Mahdimm avatar Mahdimm commented on July 17, 2024

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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@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.

Mahdimm avatar Mahdimm commented on July 17, 2024

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@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.

Mahdimm avatar Mahdimm commented on July 17, 2024

@WrathChaos
I didn't see any function like reconnect
can you tell me the name of file?
thanks

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@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.

Mahdimm avatar Mahdimm commented on July 17, 2024

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@Mahdimm
Working on it :)

from stompclientlib.

Mahdimm avatar Mahdimm commented on July 17, 2024

@WrathChaos
Thanks
Im waiting for reply

from stompclientlib.

MrShafiee avatar MrShafiee commented on July 17, 2024

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.

MrShafiee avatar MrShafiee commented on July 17, 2024

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.

Mahdimm avatar Mahdimm commented on July 17, 2024

Hi @WrathChaos

did you add delegate for subscribe & unSubscribe?

thanks for supporting

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

deni2s avatar deni2s commented on July 17, 2024

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

deni2s avatar deni2s commented on July 17, 2024

@WrathChaos I am using the latest version.

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@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.

gsathish02 avatar gsathish02 commented on July 17, 2024

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.

deni2s avatar deni2s commented on July 17, 2024

@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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@gsathish02 and @deni2s , I'm working on it. I'm going to fix it tonight.

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

Sorry guys could not make time for it. Before this weekend I will fix it.

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

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.

WrathChaos avatar WrathChaos commented on July 17, 2024

Also, I've closed this issue, please re-open for your issues and let's continue on there.

from stompclientlib.

xaeroolj avatar xaeroolj commented on July 17, 2024

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.

WrathChaos avatar WrathChaos commented on July 17, 2024

@xaeroolj Let's continue on your issue, please :)

from stompclientlib.

dev-lis avatar dev-lis commented on July 17, 2024

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.

WrathChaos avatar WrathChaos commented on July 17, 2024

Hello @4egoshev, Can you tell me which version are you using?

from stompclientlib.

dev-lis avatar dev-lis commented on July 17, 2024

I use 1.3.1 version

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@4egoshev Can you try with the latest release, please? (Currently 1.3.5)

from stompclientlib.

dev-lis avatar dev-lis commented on July 17, 2024

@WrathChaos sorry, but it does not solve my problem

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@4egoshev Can you provide me with a simple example on a repo?

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@4egoshev Love to hear that, I hope you can make it work. Have fun :)

from stompclientlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.