mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	【增强】MidjourneyWebSocket token无效会认证失败,增加 wss 通知回调,给业务方法处理
This commit is contained in:
		| @@ -56,6 +56,7 @@ public class MidjourneyWebSocketStarter implements WebSocketStarter { | |||||||
| 	 * 链接成功的 session | 	 * 链接成功的 session | ||||||
| 	 */ | 	 */ | ||||||
| 	private WebSocketSession webSocketSession = null; | 	private WebSocketSession webSocketSession = null; | ||||||
|  | 	private WssNotify wssNotify = null; | ||||||
|  |  | ||||||
| 	public MidjourneyWebSocketStarter(String wssServer, | 	public MidjourneyWebSocketStarter(String wssServer, | ||||||
| 									  String resumeWss, | 									  String resumeWss, | ||||||
| @@ -68,7 +69,8 @@ public class MidjourneyWebSocketStarter implements WebSocketStarter { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
| 	public void start() { | 	public void start(WssNotify wssNotify) { | ||||||
|  | 		this.wssNotify = wssNotify; | ||||||
| 		start(false); | 		start(false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -178,6 +180,9 @@ public class MidjourneyWebSocketStarter implements WebSocketStarter { | |||||||
|  |  | ||||||
| 	private void notifyWssLock(int code, String reason) { | 	private void notifyWssLock(int code, String reason) { | ||||||
| 		System.err.println("notifyWssLock: " + code + " - " + reason); | 		System.err.println("notifyWssLock: " + code + " - " + reason); | ||||||
|  | 		if (wssNotify != null) { | ||||||
|  | 			wssNotify.notify(code, reason); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | package cn.iocoder.yudao.framework.ai.midjourney.webSocket; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 通知信息 | ||||||
|  |  * | ||||||
|  |  * @author fansili | ||||||
|  |  * @time 2024/4/29 14:21 | ||||||
|  |  * @since 1.0 | ||||||
|  |  */ | ||||||
|  | public interface WssNotify { | ||||||
|  |  | ||||||
|  |     void notify(int code, String message); | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 cherishsince
					cherishsince