@@ -60,6 +60,42 @@ final class DXConnectionTest: XCTestCase {
60
60
wait ( for: [ receivedEventsExpectation] , timeout: 4 )
61
61
}
62
62
63
+ func testDXLinkConnectionTheoPrice( ) throws {
64
+ // For token-based authorization, use the following address format:
65
+ // "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
66
+ let endpoint = try DXEndpoint . builder ( )
67
+ . build ( )
68
+
69
+ let subscription = try endpoint. getFeed ( ) ? . createSubscription ( TheoPrice . self)
70
+ let receivedEventsExpectation = expectation ( description: " Received events " )
71
+ let eventListener = DXConnectionListener ( expectation: receivedEventsExpectation)
72
+ try subscription? . add ( listener: eventListener)
73
+ try subscription? . addSymbols ( " .AAPL240524C110 " )
74
+ try endpoint. connect ( " dxlink:wss://demo.dxfeed.com/dxlink-ws " )
75
+ defer {
76
+ try ? endpoint. closeAndAwaitTermination ( )
77
+ }
78
+ wait ( for: [ receivedEventsExpectation] , timeout: 4 )
79
+ }
80
+
81
+ func testDXLinkConnectionGreeks( ) throws {
82
+ // For token-based authorization, use the following address format:
83
+ // "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
84
+ let endpoint = try DXEndpoint . builder ( )
85
+ . build ( )
86
+
87
+ let subscription = try endpoint. getFeed ( ) ? . createSubscription ( Greeks . self)
88
+ let receivedEventsExpectation = expectation ( description: " Received events " )
89
+ let eventListener = DXConnectionListener ( expectation: receivedEventsExpectation)
90
+ try subscription? . add ( listener: eventListener)
91
+ try subscription? . addSymbols ( " .AAPL240524C110 " )
92
+ try endpoint. connect ( " dxlink:wss://demo.dxfeed.com/dxlink-ws " )
93
+ defer {
94
+ try ? endpoint. closeAndAwaitTermination ( )
95
+ }
96
+ wait ( for: [ receivedEventsExpectation] , timeout: 4 )
97
+ }
98
+
63
99
func testConnection( ) throws {
64
100
// For token-based authorization, use the following address format:
65
101
// "demo.dxfeed.com:7300[login=entitle:token]"
0 commit comments