Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StompClientDidConnect not called on a fresh project #51

Closed
xaeroolj opened this issue Jul 9, 2019 · 30 comments
Closed

StompClientDidConnect not called on a fresh project #51

xaeroolj opened this issue Jul 9, 2019 · 30 comments

Comments

@xaeroolj
Copy link

xaeroolj commented Jul 9, 2019

Good day,
I see WebSocket is connected, but delegate method StompClientDidConnect never called.

I try example code and in your project it is work fine...
But if I create new project and copy/paste same code, it fail...
I make clean setup swift 5 and 1.3.1 StompClientLib

@WrathChaos
Copy link
Owner

Hello @xaeroolj,
The example code is made from the stratch project. Can you share your example code with me?
Let's solve the issue together.

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

I try:
override func viewDidAppear(_ animated: Bool) {
socketClient.disconnect()
}
And stompClientDidDisconnect was called...

give me sec I will share code..

@WrathChaos
Copy link
Owner

Can I connect your WebSocket externally?

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

yes it work now

@WrathChaos
Copy link
Owner

@xaeroolj
I've tested your exact code and it works perfectly... What is your problem there?

Screenshot 2019-07-09 at 16 20 08

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

Yes it must work... But my output is>>
Снимок экрана 2019-07-09 в 16 23 19

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

And different result when I use example project...
Снимок экрана 2019-07-09 в 16 25 29

@WrathChaos
Copy link
Owner

WrathChaos commented Jul 9, 2019

Okay, let me create an example project for you.

@WrathChaos
Copy link
Owner

WrathChaos commented Jul 9, 2019

Wow, literally not working with a fresh project :) Let's dig deeper together @xaeroolj.
I'm currently testing on your issue. Can you please share your stomp server properties with me? Which version of Spring Boot are you using?

@WrathChaos WrathChaos changed the title StompClientDidConnect not called StompClientDidConnect not called on a fresh project Jul 9, 2019
@WrathChaos
Copy link
Owner

Okay, Here it is.
I've tried the same fresh project with my own simple stomp server. It works perfectly. I believe that there is something wrong with your backend side. Can you dig on it?

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

Well, I can find how to temporary fix this,
I take file from example project: StompClientLib.swift
and put it in the head folder of my new project.
StompClientLib.txt
Снимок экрана 2019-07-09 в 23 16 40

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

Снимок экрана 2019-07-09 в 23 19 18

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

if I delete StompClientLib.swift from project it stops working again.

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

I check 2 files for differences and its looks like problem is here on line 136-137
Снимок экрана 2019-07-09 в 23 30 28

@xaeroolj
Copy link
Author

xaeroolj commented Jul 9, 2019

One more thing,

  1. Remove file from the head
  2. replace StompClientLib.swift inside PODS/pods/StompClientLib/
  3. In Xcode: Product -> Clear build folder
  4. Build and run
    Work for me now.

AS result, in my opinion, pod install give me old version of library.

@WrathChaos
Copy link
Owner

Can you try on Podfile:
pod "StompClientLib" , "1.3.1"

I've tried the latest version, oldest version etc but the result is the same. Too weird behaviour :(
I need to investigate it.

@xaeroolj
Copy link
Author

Remove any pods, from Podfile and run pod install
add pod "StompClientLib" , "1.3.1" and run pod install again
pod install Analyzing dependencies Downloading dependencies Installing SocketRocket (0.5.1) Installing StompClientLib (1.3.1) Generating Pods project Integrating client project Sending stats Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

Check StompClientLib.swift :
/* Main Connection Method to open socket */ private func connect() { if socket?.readyState == .OPEN { // at the moment only anonymous logins self.sendFrame(command: StompCommands.commandConnect, header: connectionHeaders, body: nil) } else { self.openSocket() } }

It is still old one..

@xaeroolj
Copy link
Author

xaeroolj commented Jul 10, 2019

And for your information, Spring Boot version is 2.1.6

@WrathChaos
Copy link
Owner

Okay, I'm going to upgrade the project with 1.3.2. I guess I missed one patch. I'm gonna write you down again.

@WrathChaos
Copy link
Owner

Hi again @xaeroolj ,

I've just published the new version. Can you try it?

Release 1.3.2

@xaeroolj
Copy link
Author

Well, updated to 1.3.2

Installing SocketRocket (0.5.1)
Installing StompClientLib (1.3.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

but
no changes:
```
private func connect() {
if socket?.readyState == .OPEN {
// at the moment only anonymous logins
self.sendFrame(command: StompCommands.commandConnect, header: connectionHeaders, body: nil)
} else {
self.openSocket()
}
}

@xaeroolj
Copy link
Author

Check folder:
StompClientLib-1.3.2/StompClientLib/StompClientLib/StompClientLib

This file is from prew versions, I believe that cocoa pods get this file..

Example is working because
Xcode project contain Example/StompClientLib.swift (correct)
And when we build this this file from the head have priority over.. StompClientLib-1.3.2/StompClientLib/StompClientLib/StompClientLi

@WrathChaos
Copy link
Owner

Okay, I will fix the folder path problem ASAP and release a new version after test it.
Thank you so much for the helping @xaeroolj :) If you have time to make a PR, I would love to accept that.

@WrathChaos
Copy link
Owner

@xaeroolj Helloo again,
A new release is alive, can you try and give me feedback that issue still exist?

@xaeroolj
Copy link
Author

hello, I try it and the same problem still exist
Снимок экрана 2019-07-18 в 23 05 34

@WrathChaos
Copy link
Owner

WrathChaos commented Jul 19, 2019

Okay, I fixed it this time @xaeroolj
Totally my bad, I updated the wrong StompClientLib.swift. So sorry about that :)
Can you please check the new release:

Release: 1.3.4

@xaeroolj
Copy link
Author

Good job ;-) I am close it now

@ttansky
Copy link

ttansky commented Dec 23, 2019

Hi. Same problem with StompClientDidConnect on 1.3.7. version. Tried older versions, but always found nil when try openSocketWithURLRequest.

@WrathChaos
Copy link
Owner

Hello @ttansky, I've double checked the solution and it works on me. Can you share a reproducible minimal repo?

@ttansky
Copy link

ttansky commented Dec 24, 2019

Sorry, my issue)reconnect from example works fine. Thanks for lib)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants