File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ const globals = {
1010 varName : 'zlib' ,
1111 type : 'cjs' ,
1212 } ,
13+ 'node:crypto' : {
14+ varName : 'crypto' ,
15+ type : 'cjs' ,
16+ } ,
1317}
1418
1519const ctx = await esbuild . context ( {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import type {
1818} from 'ydoc-shared/languageServerTypes'
1919import { assertNever } from 'ydoc-shared/util/assert'
2020import { AbortScope , exponentialBackoff , printingCallbacks } from 'ydoc-shared/util/net'
21- import { ReconnectingWebSocketTransport } from 'ydoc-shared/util/net/ReconnectingWSTransport '
21+ import { YjsTransport } from 'ydoc-shared/util/net/YjsTransport '
2222import {
2323 DistributedProject ,
2424 IdMap ,
@@ -89,8 +89,10 @@ export class LanguageServerSession {
8989 /** Get a {@link LanguageServerSession} by its URL. */
9090 static get ( url : string ) : LanguageServerSession {
9191 const session = map . setIfUndefined ( LanguageServerSession . sessions , url , ( ) => {
92- const ws = new ReconnectingWebSocketTransport ( url )
93- const ls = new LanguageServer ( crypto . randomUUID ( ) , ws )
92+ const doc = new Y . Doc ( )
93+ const transport = new YjsTransport ( doc , url )
94+ transport . connect ( )
95+ const ls = new LanguageServer ( crypto . randomUUID ( ) , transport )
9496 return new LanguageServerSession ( ls , ( ) => LanguageServerSession . sessions . delete ( url ) )
9597 } )
9698 session . retain ( )
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import type {
2626 VisualizationConfiguration ,
2727} from './languageServerTypes'
2828import { AbortScope , exponentialBackoff } from './util/net'
29- import type { ReconnectingWebSocketTransport } from './util/net/ReconnectingWSTransport '
29+ import type { YjsTransport } from './util/net/YjsTransport '
3030import type { Uuid } from './yjsModel'
3131
3232const debugLog = debug ( 'ydoc-shared:languageServer' )
@@ -148,7 +148,7 @@ export class LanguageServer extends ObservableV2<Notifications & TransportEvents
148148 /** Create a {@link LanguageServer}. */
149149 constructor (
150150 private clientID : Uuid ,
151- private transport : ReconnectingWebSocketTransport ,
151+ private transport : YjsTransport ,
152152 ) {
153153 super ( )
154154 this . initialized = this . scheduleInitializationAfterConnect ( )
@@ -224,7 +224,8 @@ export class LanguageServer extends ObservableV2<Notifications & TransportEvents
224224
225225 /** Reconnect the underlying network transport. */
226226 reconnect ( ) {
227- this . transport . reconnect ( )
227+ this . transport . close ( )
228+ this . transport . connect ( )
228229 }
229230
230231 // The "magic bag of holding" generic that is only present in the return type is UNSOUND.
You can’t perform that action at this time.
0 commit comments